제출 #446038

#제출 시각아이디문제언어결과실행 시간메모리
446038cs71107콤보 (IOI18_combo)C++14
5 / 100
1 ms220 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char val[10]; std::string guess_sequence(int N) { string AB = "AB"; string AX = "AX"; int ab = press(AB); int ax = press(AX); string ans = ""; char st = 0; if(ab&&ax){ ans = "A"; st = 'A'; val[0] = 'B'; val[1] = 'X'; val[2] = 'Y'; } else if(ab){ ans = "B"; st = 'B'; val[0] = 'A'; val[1] = 'X'; val[2] = 'Y'; } else if(ax){ ans = "X"; st = 'X'; val[0] = 'A'; val[1] = 'B'; val[2] = 'Y'; } else { ans = "Y"; st = 'Y'; val[0] = 'A'; val[1] = 'B'; val[2] = 'X'; } string tz = ""; string to = ""; string tt = ""; string oz = ""; tz += val[2]; tz += val[0]; to += val[2]; to += val[1]; tt += val[2]; tt += val[2]; oz += val[1]; for(int i=1;i<N-1;i++){ string curs = ans+tz; curs+=(ans+to); curs+=(ans+tt); curs+=(ans+oz); int curv = press(curs); assert(curv<=i+2); ans+=val[curv-i]; } string ansz = ans+val[0]; string anso = ans+val[1]; if(press(ansz)==N){ ans+=val[0]; } else if(press(anso)==N){ ans+=val[1]; } else { ans+=val[2]; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:8: warning: variable 'st' set but not used [-Wunused-but-set-variable]
   18 |   char st = 0;
      |        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...