Submission #671002

#TimeUsernameProblemLanguageResultExecution timeMemory
671002ArixcrestCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
string fillseq(string s,int sz){ string temp = ""; while(temp.size()<sz){ temp+=s; } while(temp.size()>sz) temp.pop_back(); return temp; } string guess_sequence(int n){ n = 4*n; int mx = 0; string ans = ""; int v; vector<char> vals = {'A','B','X','Y'}; int cnt =0; while(mx!=n/4){ cnt++; if(mx==0){ string temp1 = fillseq("A",n/2); temp1+=fillseq("B",n/2); v = press(temp1); if(v>mx){ temp1 = fillseq("A",n); v = press(temp1); if(v>mx){ mx = v; ans+="A"; }else{ ans+="B"; } }else{ temp1 = fillseq("X",n); v = press(temp1); if(v>mx){ mx = v; ans+='X'; }else{ mx = v; ans+="Y"; } } for(auto it = vals.begin();it!=vals.end();it++){ if(*it==ans.front()){ vals.erase(it); break; } } }else{ if(mx==n/4-1){ string temp1 = ans+vals[0]; while(temp1.size()<n) temp1+=(ans.front()); v = press(temp1); if(v-mx==1){ ans+=vals[0]; break; } temp1 = ans+vals[1]; while(temp1.size()<n) temp1+=(ans.front()); v = press(temp1); if(v-mx==1){ ans+=vals[1]; break; }else{ ans+=vals[2]; break; } } else{ string temp1 = ans+vals[0]+vals[0]; temp1+=ans+vals[0]+vals[1]; temp1+=ans+vals[0]+vals[2]; temp1+=ans+vals[1]; while(temp1.size()<n) temp1+=(ans.front()); v = press(temp1); if(v-mx==2){ ans+=vals[0]; }else if(v-mx==1){ ans+=vals[1]; }else{ ans+=(vals[2]); } mx++; } } } // cout<<cnt<<" "<<ans<<"\n"; return ans; }

Compilation message (stderr)

combo.cpp:1:1: error: 'string' does not name a type
    1 | string fillseq(string s,int sz){
      | ^~~~~~
combo.cpp:9:1: error: 'string' does not name a type
    9 | string guess_sequence(int n){
      | ^~~~~~