제출 #1271209

#제출 시각아이디문제언어결과실행 시간메모리
1271209mkkkkkkkk콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char c=NULL; int br=press("AB"); if(br==1) { br=press("A"); if(br==1) c='A'; else c='B'; } else { br=press("X"); if(br==1) c='X'; else c='Y'; } string possible=""; if(c!='A') possible.push_back('A'); if(c!='B') possible.push_back('B'); if(c!='X') possible.push_back('X'); if(c!='Y') possible.push_back('Y'); string res=""; res.push_back(c); for(int i=1;i<N-1;i++) { string temp=""; temp+=res; temp.push_back(possible[0]); temp.push_back(possible[0]); temp+=res; temp.push_back(possible[0]); temp.push_back(possible[1]); temp+=res; temp.push_back(possible[0]); temp.push_back(possible[2]); temp+=res; temp.push_back(possible[1]); br=press(temp); if(br==i+1) { res.push_back(possible[1]); } else if(br==i+2) { res.push_back(possible[0]); } else { res.push_back(possible[2]); } } br=press(res+"AB"); if(br==1) { br=press(res+"A"); if(br==N) res.push_back('A'); else res.push_back('B'); } else { br=press(res+"X"); if(br==N) res.push_back('X'); else res.push_back('Y'); } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:12: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]
    7 |     char c=NULL;
      |            ^~~~
combo.cpp:8:12: error: 'press' was not declared in this scope
    8 |     int br=press("AB");
      |            ^~~~~