Submission #1173876
Source Code Expand
#include<iostream>
#include<random>
#include<array>
#include<sstream>
using namespace std;
constexpr int N=8;
mt19937 engine;
int count(int x){
return __builtin_popcount(x);
}
double rtexp(int r){
return r*80;
}
template<class E>
double exps(const E &A,const E &C,int D,int T,int r,int rb){
if(r<=0)return 0;
if(T==0){
if(rb<=0)return rtexp(r);
double res=0;
for(int i=1;i<=10;i++){
for(int j=1;j<=50;j++){
res+=exps(A,C,j,i,r,rb-1)/500;
}
}
return res;
}
int t=1e9,b;
for(int i=0;i<1<<N;i++){
int c=0;
int rm=0;
for(int j=0;j<N;j++){
if(i>>j&1){
c+=C[j];
if(A[j]!=C[j]){
rm++;
}
}
}
if(c==D){
if(rm<t){
t=rm;
b=i;
}
}
}
if(t>=1e8||t+1>T){
return rtexp(r-1);
}else{
return D*D+rtexp(r-t-1);
}
}
int main(){
for(int i=0;i<1000;i++){
int D,T;
cin>>D>>T;
array<signed char,N> C,A;
for(int j=0;j<N;j++){
int i;
cin>>i;
C[j]=i;
}
for(int j=0;j<N;j++){
int i;
cin>>i;
A[j]=i;
}
int t=1e9,b;
for(int i=0;i<1<<N;i++){
int c=0;
int rm=0;
for(int j=0;j<N;j++){
if(i>>j&1){
c+=C[j];
if(A[j]!=C[j]){
rm++;
}
}
}
if(c==D){
if(rm<t){
t=rm;
b=i;
}
}
}
if(t>1e8){
auto resd=1000-1-i;
double es=exps(A,C,D,0,resd,1);
string res="pass";
for(int j=0;j<N;j++){
auto ca=A;
ca[j]=0;
double cs=0;
for(int k=1;k<=10;k++){
auto cc=C;
cc[j]=k;
cs+=exps(ca,cc,D,T-1,resd,0)/10;
}
if(cs>es){
es=cs;
stringstream ss;
ss<<"change "<<j+1;
res=ss.str();
}
}
cout<<res<<endl;
}else{
if(t==0){
cout<<"sell "<<count(b);
for(int j=0;j<N;j++){
if(b>>j&1){
cout<<' '<<j+1;
}
}
cout<<endl;
}else{
for(int j=0;;j++){
if(b>>j&1&&A[j]!=C[j]){
cout<<"fill "<<j+1<<endl;
break;
}
}
}
}
}
}
Submission Info
Submission Time |
|
Task |
A - 石油王Xの憂鬱 |
User |
ustimaw |
Language |
C++14 (GCC 5.4.1) |
Score |
5023814 |
Code Size |
2070 Byte |
Status |
AC |
Exec Time |
765 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 |
98800 / 417500 |
98563 / 417500 |
105011 / 417500 |
96418 / 417500 |
86718 / 417500 |
106671 / 417500 |
116544 / 417500 |
94987 / 417500 |
104267 / 417500 |
99055 / 417500 |
117627 / 417500 |
102429 / 417500 |
107427 / 417500 |
98318 / 417500 |
105207 / 417500 |
98302 / 417500 |
93169 / 417500 |
103944 / 417500 |
99728 / 417500 |
105730 / 417500 |
105811 / 417500 |
91237 / 417500 |
96483 / 417500 |
100117 / 417500 |
97313 / 417500 |
90401 / 417500 |
100251 / 417500 |
101354 / 417500 |
99210 / 417500 |
106805 / 417500 |
96199 / 417500 |
98305 / 417500 |
103280 / 417500 |
97734 / 417500 |
101884 / 417500 |
92842 / 417500 |
100811 / 417500 |
97508 / 417500 |
104118 / 417500 |
97555 / 417500 |
104533 / 417500 |
93687 / 417500 |
99454 / 417500 |
91161 / 417500 |
99393 / 417500 |
107811 / 417500 |
105375 / 417500 |
100872 / 417500 |
100891 / 417500 |
102504 / 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 |
497 ms |
720 KB |
subtask_01_02.txt |
AC |
601 ms |
692 KB |
subtask_01_03.txt |
AC |
598 ms |
724 KB |
subtask_01_04.txt |
AC |
709 ms |
716 KB |
subtask_01_05.txt |
AC |
739 ms |
716 KB |
subtask_01_06.txt |
AC |
587 ms |
688 KB |
subtask_01_07.txt |
AC |
532 ms |
724 KB |
subtask_01_08.txt |
AC |
667 ms |
720 KB |
subtask_01_09.txt |
AC |
581 ms |
716 KB |
subtask_01_10.txt |
AC |
635 ms |
716 KB |
subtask_01_11.txt |
AC |
541 ms |
708 KB |
subtask_01_12.txt |
AC |
748 ms |
720 KB |
subtask_01_13.txt |
AC |
519 ms |
724 KB |
subtask_01_14.txt |
AC |
690 ms |
720 KB |
subtask_01_15.txt |
AC |
552 ms |
720 KB |
subtask_01_16.txt |
AC |
762 ms |
592 KB |
subtask_01_17.txt |
AC |
546 ms |
720 KB |
subtask_01_18.txt |
AC |
665 ms |
720 KB |
subtask_01_19.txt |
AC |
610 ms |
720 KB |
subtask_01_20.txt |
AC |
599 ms |
720 KB |
subtask_01_21.txt |
AC |
522 ms |
720 KB |
subtask_01_22.txt |
AC |
629 ms |
592 KB |
subtask_01_23.txt |
AC |
736 ms |
712 KB |
subtask_01_24.txt |
AC |
620 ms |
720 KB |
subtask_01_25.txt |
AC |
512 ms |
724 KB |
subtask_01_26.txt |
AC |
699 ms |
716 KB |
subtask_01_27.txt |
AC |
573 ms |
724 KB |
subtask_01_28.txt |
AC |
554 ms |
720 KB |
subtask_01_29.txt |
AC |
763 ms |
720 KB |
subtask_01_30.txt |
AC |
626 ms |
720 KB |
subtask_01_31.txt |
AC |
765 ms |
720 KB |
subtask_01_32.txt |
AC |
668 ms |
724 KB |
subtask_01_33.txt |
AC |
598 ms |
720 KB |
subtask_01_34.txt |
AC |
573 ms |
716 KB |
subtask_01_35.txt |
AC |
565 ms |
716 KB |
subtask_01_36.txt |
AC |
569 ms |
720 KB |
subtask_01_37.txt |
AC |
736 ms |
720 KB |
subtask_01_38.txt |
AC |
608 ms |
592 KB |
subtask_01_39.txt |
AC |
480 ms |
716 KB |
subtask_01_40.txt |
AC |
670 ms |
724 KB |
subtask_01_41.txt |
AC |
593 ms |
716 KB |
subtask_01_42.txt |
AC |
683 ms |
720 KB |
subtask_01_43.txt |
AC |
573 ms |
720 KB |
subtask_01_44.txt |
AC |
541 ms |
720 KB |
subtask_01_45.txt |
AC |
539 ms |
712 KB |
subtask_01_46.txt |
AC |
609 ms |
720 KB |
subtask_01_47.txt |
AC |
561 ms |
592 KB |
subtask_01_48.txt |
AC |
639 ms |
720 KB |
subtask_01_49.txt |
AC |
605 ms |
720 KB |
subtask_01_50.txt |
AC |
661 ms |
720 KB |