Submission #1173968


Source Code Expand

#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t) {
	stringstream ss;
	ss << f;
	ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x)
#define debug(x)
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

int D, T;
vint C(8), A(8);

void q_fill(int a) {
	cout << "fill " << a + 1 << endl;
}

void q_move(int a, int b) {
	cout << "move " << a + 1 << " " << b + 1 << endl;
}

void q_change(int a) {
	cout << "change " << a + 1 << endl;
}

void q_pass() {
	cout << "pass" << endl;
}

void q_sell(int n, vint v) {
	cout << "sell " << n;
	rep(i, v.size()) {
		cout << " " << v[i] + 1;
	}
	cout << endl;
}

pii check(int D, int T){
	int cnt = INF;
	int state = 0;
	rep(s,1<<8){
		int cc = 0;
		int tt = 0;
		rep(j,8){
			if(s&(1<<j)){
				cc+=C[j];
				if(C[j]!=A[j]) tt++;
			}
		}
		if(cc == D && tt < cnt){
			cnt = tt;
			state = s;
		}
	}
	return pii(cnt, state);
}


void mainmain() {
	srand(time(NULL));
	int turn = 0;
	while(1) {
		if(turn++ >= 1000) break;
		cin>>D>>T;
		rep(i, 8) cin >> C[i];
		rep(i, 8) cin >> A[i];
		pii p = check(D, T);
		if(p.F == INF || D < 32) {
			bool f = false;
			rep(i,8){
				if(C[i] < 5){
					q_change(i);
					f = true;
					break;
				}
			}
			if(f) continue;
			rep(i,8){
				if(C[i]!=A[i]){
					q_fill(i);
					f = true;
					break;
				}
			}
			if(f) continue;
			q_pass();
			// int t = rand() % 5;
			// if(t == 0) {
			// 	q_pass();
			// }
			// else if(t == 1) {
			// 	q_change(rand() % 8);
			// }
			// else {
			// 	bool f = false;
			// 	rep(i, 8) {
			// 		if(C[i] != A[i]) continue;
			// 		q_fill(i);
			// 		f = true;
			// 		break;
			// 	}
			// 	if(!f) {
			// 		q_pass();
			// 	}
			// }
		}
		else {
			if(p.F == 0) {
				vint tmp;
				rep(i, 8) {
					if(p.S & (1 << i)) {
						tmp.PB(i);
					}
				}
				q_sell(tmp.size(), tmp);
			}
			else {
				rep(i, 8) {
					if(p.S & (1 << i) && C[i] != A[i]) {
						q_fill(i);
						break;
					}
				}
			}
		}
	}
}
/*
1. 85559

D  score 
25  146517
30  148750
31  142372
34  139414
35  139816
*/


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	mainmain();
}

Submission Info

Submission Time
Task A - 石油王Xの憂鬱
User j_gui0121
Language C++14 (GCC 5.4.1)
Score 7169275
Code Size 4079 Byte
Status AC
Exec Time 51 ms
Memory 724 KB

Judge Result

Set Name test_01 test_02 test_03 test_04 test_05 test_06 test_07 test_08 test_09 test_10 test_11 test_12 test_13 test_14 test_15 test_16 test_17 test_18 test_19 test_20 test_21 test_22 test_23 test_24 test_25 test_26 test_27 test_28 test_29 test_30 test_31 test_32 test_33 test_34 test_35 test_36 test_37 test_38 test_39 test_40 test_41 test_42 test_43 test_44 test_45 test_46 test_47 test_48 test_49 test_50
Score / Max Score 137335 / 417500 144531 / 417500 149874 / 417500 142866 / 417500 153857 / 417500 145652 / 417500 149175 / 417500 141401 / 417500 145578 / 417500 147512 / 417500 149397 / 417500 144667 / 417500 148577 / 417500 144555 / 417500 136660 / 417500 146823 / 417500 136514 / 417500 144421 / 417500 147130 / 417500 138179 / 417500 153330 / 417500 142606 / 417500 130689 / 417500 139100 / 417500 143717 / 417500 134621 / 417500 140865 / 417500 150720 / 417500 144515 / 417500 145622 / 417500 150034 / 417500 135939 / 417500 142264 / 417500 142458 / 417500 144906 / 417500 146066 / 417500 136787 / 417500 143017 / 417500 134176 / 417500 144886 / 417500 150993 / 417500 145422 / 417500 144788 / 417500 140278 / 417500 144432 / 417500 146512 / 417500 142165 / 417500 132800 / 417500 134964 / 417500 145899 / 417500
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
Set Name Test Cases
test_01 subtask_01_01.txt
test_02 subtask_01_02.txt
test_03 subtask_01_03.txt
test_04 subtask_01_04.txt
test_05 subtask_01_05.txt
test_06 subtask_01_06.txt
test_07 subtask_01_07.txt
test_08 subtask_01_08.txt
test_09 subtask_01_09.txt
test_10 subtask_01_10.txt
test_11 subtask_01_11.txt
test_12 subtask_01_12.txt
test_13 subtask_01_13.txt
test_14 subtask_01_14.txt
test_15 subtask_01_15.txt
test_16 subtask_01_16.txt
test_17 subtask_01_17.txt
test_18 subtask_01_18.txt
test_19 subtask_01_19.txt
test_20 subtask_01_20.txt
test_21 subtask_01_21.txt
test_22 subtask_01_22.txt
test_23 subtask_01_23.txt
test_24 subtask_01_24.txt
test_25 subtask_01_25.txt
test_26 subtask_01_26.txt
test_27 subtask_01_27.txt
test_28 subtask_01_28.txt
test_29 subtask_01_29.txt
test_30 subtask_01_30.txt
test_31 subtask_01_31.txt
test_32 subtask_01_32.txt
test_33 subtask_01_33.txt
test_34 subtask_01_34.txt
test_35 subtask_01_35.txt
test_36 subtask_01_36.txt
test_37 subtask_01_37.txt
test_38 subtask_01_38.txt
test_39 subtask_01_39.txt
test_40 subtask_01_40.txt
test_41 subtask_01_41.txt
test_42 subtask_01_42.txt
test_43 subtask_01_43.txt
test_44 subtask_01_44.txt
test_45 subtask_01_45.txt
test_46 subtask_01_46.txt
test_47 subtask_01_47.txt
test_48 subtask_01_48.txt
test_49 subtask_01_49.txt
test_50 subtask_01_50.txt
Case Name Status Exec Time Memory
subtask_01_01.txt AC 46 ms 720 KB
subtask_01_02.txt AC 45 ms 720 KB
subtask_01_03.txt AC 47 ms 720 KB
subtask_01_04.txt AC 47 ms 720 KB
subtask_01_05.txt AC 46 ms 716 KB
subtask_01_06.txt AC 46 ms 716 KB
subtask_01_07.txt AC 45 ms 720 KB
subtask_01_08.txt AC 46 ms 720 KB
subtask_01_09.txt AC 45 ms 716 KB
subtask_01_10.txt AC 49 ms 720 KB
subtask_01_11.txt AC 46 ms 720 KB
subtask_01_12.txt AC 46 ms 720 KB
subtask_01_13.txt AC 45 ms 720 KB
subtask_01_14.txt AC 46 ms 680 KB
subtask_01_15.txt AC 42 ms 720 KB
subtask_01_16.txt AC 45 ms 720 KB
subtask_01_17.txt AC 47 ms 724 KB
subtask_01_18.txt AC 46 ms 720 KB
subtask_01_19.txt AC 46 ms 720 KB
subtask_01_20.txt AC 47 ms 720 KB
subtask_01_21.txt AC 45 ms 596 KB
subtask_01_22.txt AC 45 ms 716 KB
subtask_01_23.txt AC 43 ms 628 KB
subtask_01_24.txt AC 46 ms 720 KB
subtask_01_25.txt AC 45 ms 720 KB
subtask_01_26.txt AC 45 ms 720 KB
subtask_01_27.txt AC 44 ms 716 KB
subtask_01_28.txt AC 47 ms 720 KB
subtask_01_29.txt AC 44 ms 720 KB
subtask_01_30.txt AC 47 ms 720 KB
subtask_01_31.txt AC 43 ms 720 KB
subtask_01_32.txt AC 46 ms 724 KB
subtask_01_33.txt AC 46 ms 720 KB
subtask_01_34.txt AC 46 ms 720 KB
subtask_01_35.txt AC 48 ms 716 KB
subtask_01_36.txt AC 46 ms 724 KB
subtask_01_37.txt AC 46 ms 716 KB
subtask_01_38.txt AC 48 ms 724 KB
subtask_01_39.txt AC 43 ms 724 KB
subtask_01_40.txt AC 51 ms 720 KB
subtask_01_41.txt AC 46 ms 720 KB
subtask_01_42.txt AC 45 ms 720 KB
subtask_01_43.txt AC 45 ms 724 KB
subtask_01_44.txt AC 47 ms 724 KB
subtask_01_45.txt AC 46 ms 720 KB
subtask_01_46.txt AC 45 ms 724 KB
subtask_01_47.txt AC 43 ms 720 KB
subtask_01_48.txt AC 45 ms 720 KB
subtask_01_49.txt AC 46 ms 716 KB
subtask_01_50.txt AC 44 ms 716 KB