Submission #4415280

Source Code Expand

Copy
```#include <iostream>
#include <vector>
using namespace std;
int N = 8,D,T,C[8],A[8];
void print(int a,vector<int>& v){
if(a==1) cout << "fill " << v[0] << endl;
if(a==2) cout << "move " << v[0] << " " << v[1] << endl;
if(a==3) cout << "change " << v[0] << endl;
if(a==4){
cout << "sell " << v.size() << " ";
for(auto x:v) cout << x << " ";
cout << endl;
}
if(a==5) cout << "pass" << endl;
}

vector<int> ok(){
vector<int> res(9,-1);
for(int i=0;i<(1<<N);i++){
vector<int> now;
int cnt = 0,sum = 0;
for(int j=0;j<N;j++){
if(i&(1<<j)){
now.push_back(j+1);
if(A[j]!=C[j]) cnt++;
sum += C[j];
}
}
if(cnt<=T && sum==D && (int) res.size()>cnt){
res = now;
}
}
return res;
}

int main(){
for(int t=0;t<1000;t++){
cin >> D >> T;
for(int i=0;i<8;i++){
cin >> C[i];
}
for(int i=0;i<8;i++){
cin >> A[i];
}
vector<int> res = ok();
if(res[0]==-1 || D<15){
bool use = true;
for(int i=0;i<8;i++){
if(C[i]<=3){
vector<int> v = {i+1};
print(3,v);
use = false;
break;
}
}
if(!use) continue;
for(int i=0;i<8;i++){
if(A[i]==0){
use = false;
vector<int> v = {i+1};
print(1,v);
break;
}
}
if(use) print(5,res);
}
else{
bool judge = true;
for(auto x:res){
if(A[x-1]==0){
judge = false;
vector<int> v = {x};
print(1,v);
break;
}
}
if(judge){
print(4,res);
}
}
}
}```

#### Submission Info

Submission Time 2019-03-01 00:33:19+0900 A - 石油王Xの憂鬱 idsigma C++14 (GCC 5.4.1) 6810047 1520 Byte AC 109 ms 724 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Case Name Status Exec Time Memory