제출 #501332

#제출 시각아이디문제언어결과실행 시간메모리
501332shantol콤보 (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string a; char x,y,z; for(int i=0;i<N;i++){ if(i==0){ if(press("AB")){ if(press("A")){ a="A"; x='B'; y='X'; z='Y'; } else { a="B"; x='A'; y='X'; z='Y'; } } else if(press("X")){ a="X"; x='B'; y='A'; z='Y'; } else { a="Y"; x='B'; y='X'; z='A'; } } else if(i==N-1){ if(press(a+x)){a+=x;} else if(press(a+y)){a+=y;} else {a+=z;} } else{ int p=press(a+x+x+a+x+y+a+x+z+a+y); if(p==2){a+=x;} else if(p==1){a+=y;} else {a+=z;} } } return a; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:29: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |             else if(press(a+y)){a+=y;}
      |                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...