제출 #298650

#제출 시각아이디문제언어결과실행 시간메모리
298650AmineTrabelsi콤보 (IOI18_combo)C++17
0 / 100
0 ms200 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define v(x) vector<x> #define pb push_back #define mp make_pair const ll maxint=2e18; const ll minint =-2e18; /* (͡ ° ͜ʖ ͡ °): Hi, be careful of overflow. */ int press(string p); /* // comment out when submitting int cnt = 0; int n; int press(string p){ cnt++; cout<<p<<endl; if((int)p.size() > n*4){ cout<<"Failed press n="<<(int)p.size()<<endl; exit(0); } int x; cin>>x; return x; } */ string let[4]={"A","B","X","Y"}; string guess_sequence(int N){ //n=N; string res =""; int avoid = 0; int x = press(let[0]+let[1]); if(x >= 1){ x = press(let[0]); if(x == 1){avoid=0; res+=let[0]; }else {avoid=1;res += let[1];} }else{ x = press(let[2]); if(x == 1){ res+=let[2];avoid=2; }else {avoid=3;res +=let[3];} } vector<string> lett; for(int i=0;i<4;i++)if(i!=avoid)lett.push_back(let[i]); for(auto i:lett)cout<<i<<" ";cout<<endl; int i=1; for(;i<N-1;i++){ x = press((res+lett[0]+lett[0]+res+lett[0]+lett[1]+res+lett[0]+lett[2]+res+lett[1])); if(x == i+2){ res+=lett[0]; }else if(x == i+1){ res+=lett[1]; } else{ res += lett[2]; } } if(i < N){ x = press(res+lett[0]+res+lett[1]); if(x == i+1){ x = press(res+lett[0]); if(x == i+1){ res+=lett[0]; }else res+=lett[1]; }else{ res += lett[2]; } } return res; } //* Notes: //* the first character of S never reappears in it /* // comment out when submitting int main(){ int n; cin>>n; cout<<guess_sequence(n)<<'\n'; cout<<cnt<<endl; return 0; } */ /* 5 YABAB 4 = q-N */

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:51:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   51 |   for(auto i:lett)cout<<i<<" ";cout<<endl;
      |   ^~~
combo.cpp:51:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   51 |   for(auto i:lett)cout<<i<<" ";cout<<endl;
      |                                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...