제출 #990037

#제출 시각아이디문제언어결과실행 시간메모리
990037TitanicXDzz콤보 (IOI18_combo)C++14
100 / 100
21 ms1936 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { std::string p = "AB"; int coins = press(p); if(coins>=1){ string s="A"; coins=press(s); if(coins==1){ if(N==1) return "A"; p="A"; for(int i=2;i<N;i++){ s=p+"BB"+p+"BX"+p+"BY"+p+"X"; coins=press(s); if(coins==i+1) p+="B"; else if(coins==i) p+="X"; else p+="Y"; } s=p+"B"; coins=press(s); if(coins==N) p=s; else{ s=p+"X"; coins=press(s); if(coins==N) p=s; else p+="Y"; } } else{ if(N==1) return "B"; p="B"; for(int i=2;i<N;i++){ s=p+"AA"+p+"AX"+p+"AY"+p+"X"; coins=press(s); if(coins==i+1) p+="A"; else if(coins==i) p+="X"; else p+="Y"; } s=p+"A"; coins=press(s); if(coins==N) p=s; else{ s=p+"X"; coins=press(s); if(coins==N) p=s; else p+="Y"; } } } else{ string s="X"; coins=press(s); if(coins==1){ if(N==1) return "X"; p="X"; for(int i=2;i<N;i++){ s=p+"BB"+p+"BA"+p+"BY"+p+"A"; coins=press(s); if(coins==i+1) p+="B"; else if(coins==i) p+="A"; else p+="Y"; } s=p+"B"; coins=press(s); if(coins==N) p=s; else{ s=p+"A"; coins=press(s); if(coins==N) p=s; else p+="Y"; } } else{ p="Y"; if(N==1) return "Y"; for(int i=2;i<N;i++){ s=p+"AA"+p+"AX"+p+"AB"+p+"X"; coins=press(s); if(coins==i+1) p+="A"; else if(coins==i) p+="X"; else p+="B"; } s=p+"A"; coins=press(s); if(coins==N) p=s; else{ s=p+"X"; coins=press(s); if(coins==N) p=s; else p+="B"; } } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:97:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   97 |         if(N==1)
      |         ^~
combo.cpp:99:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   99 |             for(int i=2;i<N;i++){
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...