Submission #1174382
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define WIN_WIDTH (1900)
#define WIN_HEIGHT (900)
#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
typedef long long ll;
typedef pair <int, int> ii;
vector <vector <ii> > p(500, vector <ii>(9));
vector <string> s(50);
vector <vector <bool> > used(50, vector <bool>(50, false));
vector <vector <bool> > used_now(50, vector <bool>(50));
int cnt;
int num;
int dy[4] = { -1, 0, 1, 0 };
int dx[4] = { 0, 1, 0, -1 };
int d, t;
vector <int> c(8), a(8);
int itr;
void in() {
itr++;
cin >> d >> t;
rep(i, 8) cin >> c[i];
rep(i, 8) cin >> a[i];
}
void sell(vector<int> sells){
cout << "sell " << sells.size();
rep(j, sells.size()) cout << " " << sells[j] + 1;
cout << endl;
}
int is_emp(){
rep(i, 8) if(c[i] != a[i]) return i;
return -1;
}
int main() {
srand((unsigned) time(NULL));
itr = 0;
bool cFlag = false;
while(itr < 998) {
in();
int mini = 9;
vector <int> minv;
rep(i, 256) {
int tmp = i;
int sums = 0;
rep(j, 8) {
if(tmp % 2 == 1) sums += c[j];
tmp /= 2;
}
if(sums == d) {
tmp = i;
vector <int> used;
int cnt = 0;
rep(j, 8) {
if(tmp % 2 == 1) {
used.push_back(j);
if(c[j] != a[j]) cnt++;
}
tmp /= 2;
}
if(mini > cnt) {
mini = cnt;
minv = used;
}
}
}
if(mini != 9) cFlag = false;
if(mini == 9) {
if(d < 10){
cout << "pass" << endl;
cFlag = false;
}
else if(!cFlag) {
int min_c = c[0];
int min_c_num = 0;
rep(i, 8){
if(min_c > c[i]){
min_c = c[i];
min_c_num = i;
}
}
cout << "change " << min_c_num + 1 << endl;
cFlag = true;
}
else{
cout << "pass" << endl;
cFlag = false;
}
}
else if(mini >= t) {
bool noempty = true;
int max_c = 0;
int max_c_num = 0;
rep(i, 8) if(c[i] != a[i]) {
noempty = false;
if(max_c < c[i]){
max_c = c[i];
max_c_num = i;
}
}
if(noempty) cout << "pass" << endl;
else cout << "fill " << max_c_num + 1 << endl;
}
else if(itr + mini < 1000) {
rep(i, minv.size()) {
if(c[minv[i]] != a[minv[i]]) {
cout << "fill " << minv[i] + 1 << endl;
in();
}
}
if(t > 1) {
if(is_emp() == -1) sell(minv);
else{
rep(j, 8){
if(t == 1) break;
if(c[j] != a[j]){
cout << "fill " << j + 1 << endl;
in();
}
}
sell(minv);
}
}
else {
sell(minv);
}
}
else cout << "pass" << endl;
}
while(itr < 1000){
in();
cout << "pass" <<endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 石油王Xの憂鬱 |
User |
letter |
Language |
C++14 (GCC 5.4.1) |
Score |
5659543 |
Code Size |
2871 Byte |
Status |
AC |
Exec Time |
49 ms |
Memory |
848 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 |
116149 / 417500 |
115253 / 417500 |
112751 / 417500 |
107713 / 417500 |
110354 / 417500 |
123691 / 417500 |
122197 / 417500 |
114821 / 417500 |
106633 / 417500 |
133212 / 417500 |
120541 / 417500 |
105929 / 417500 |
123395 / 417500 |
116570 / 417500 |
109105 / 417500 |
121973 / 417500 |
104468 / 417500 |
109952 / 417500 |
119450 / 417500 |
112836 / 417500 |
123997 / 417500 |
115260 / 417500 |
101537 / 417500 |
105464 / 417500 |
120528 / 417500 |
117203 / 417500 |
107098 / 417500 |
119438 / 417500 |
118468 / 417500 |
114318 / 417500 |
116355 / 417500 |
103580 / 417500 |
107324 / 417500 |
112470 / 417500 |
111042 / 417500 |
122062 / 417500 |
110363 / 417500 |
110603 / 417500 |
105977 / 417500 |
108213 / 417500 |
109930 / 417500 |
110262 / 417500 |
108900 / 417500 |
107960 / 417500 |
111967 / 417500 |
111674 / 417500 |
117897 / 417500 |
99084 / 417500 |
105561 / 417500 |
118015 / 417500 |
Status |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
44 ms |
724 KB |
subtask_01_02.txt |
AC |
47 ms |
720 KB |
subtask_01_03.txt |
AC |
45 ms |
720 KB |
subtask_01_04.txt |
AC |
46 ms |
724 KB |
subtask_01_05.txt |
AC |
44 ms |
724 KB |
subtask_01_06.txt |
AC |
45 ms |
720 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 |
46 ms |
724 KB |
subtask_01_11.txt |
AC |
46 ms |
720 KB |
subtask_01_12.txt |
AC |
49 ms |
716 KB |
subtask_01_13.txt |
AC |
44 ms |
720 KB |
subtask_01_14.txt |
AC |
46 ms |
720 KB |
subtask_01_15.txt |
AC |
44 ms |
724 KB |
subtask_01_16.txt |
AC |
46 ms |
724 KB |
subtask_01_17.txt |
AC |
45 ms |
716 KB |
subtask_01_18.txt |
AC |
46 ms |
720 KB |
subtask_01_19.txt |
AC |
46 ms |
720 KB |
subtask_01_20.txt |
AC |
45 ms |
720 KB |
subtask_01_21.txt |
AC |
43 ms |
720 KB |
subtask_01_22.txt |
AC |
44 ms |
720 KB |
subtask_01_23.txt |
AC |
46 ms |
720 KB |
subtask_01_24.txt |
AC |
43 ms |
716 KB |
subtask_01_25.txt |
AC |
46 ms |
596 KB |
subtask_01_26.txt |
AC |
45 ms |
720 KB |
subtask_01_27.txt |
AC |
44 ms |
848 KB |
subtask_01_28.txt |
AC |
45 ms |
716 KB |
subtask_01_29.txt |
AC |
45 ms |
716 KB |
subtask_01_30.txt |
AC |
45 ms |
720 KB |
subtask_01_31.txt |
AC |
42 ms |
720 KB |
subtask_01_32.txt |
AC |
46 ms |
724 KB |
subtask_01_33.txt |
AC |
46 ms |
724 KB |
subtask_01_34.txt |
AC |
47 ms |
720 KB |
subtask_01_35.txt |
AC |
46 ms |
720 KB |
subtask_01_36.txt |
AC |
44 ms |
716 KB |
subtask_01_37.txt |
AC |
45 ms |
720 KB |
subtask_01_38.txt |
AC |
45 ms |
720 KB |
subtask_01_39.txt |
AC |
46 ms |
720 KB |
subtask_01_40.txt |
AC |
45 ms |
716 KB |
subtask_01_41.txt |
AC |
45 ms |
720 KB |
subtask_01_42.txt |
AC |
44 ms |
716 KB |
subtask_01_43.txt |
AC |
46 ms |
720 KB |
subtask_01_44.txt |
AC |
46 ms |
720 KB |
subtask_01_45.txt |
AC |
44 ms |
716 KB |
subtask_01_46.txt |
AC |
46 ms |
716 KB |
subtask_01_47.txt |
AC |
45 ms |
720 KB |
subtask_01_48.txt |
AC |
47 ms |
720 KB |
subtask_01_49.txt |
AC |
46 ms |
720 KB |
subtask_01_50.txt |
AC |
45 ms |
720 KB |