제출 #262122

#제출 시각아이디문제언어결과실행 시간메모리
262122Rainbowbunny콤보 (IOI18_combo)C++17
5 / 100
3 ms456 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; map <char, char> M; string guess_sequence(int n) { string ans; M['A'] = 'A'; M['B'] = 'B'; M['X'] = 'X'; M['Y'] = 'Y'; int a = press("AX"); if(a > 0) { int b = press("A"); if(b > 0) { ans.push_back('A'); } else { ans.push_back('X'); } } else { int b = press("Y"); if(b > 0) { ans.push_back('Y'); } else { ans.push_back('B'); } } swap(M[ans[0]], M['Y']); for(int i = 1; i < n; i++) { if(i == n - 1) { string temp = ans; temp.push_back(M['A']); int cnt = press(temp); if(cnt == n) { return temp; } temp.back() = M['B']; cnt = press(temp); if(cnt == n) { return temp; } ans.push_back(M['X']); return ans; } else { string temp; temp = ans; temp.push_back(M['A']); temp.push_back(M['B']); temp += ans; temp.push_back(M['A']); temp.push_back(M['A']); temp += ans; temp.push_back(M['A']); temp.push_back(M['X']); temp += ans; temp.push_back(M['B']); int cnt = press(temp); if(cnt == i) { ans.push_back(M['X']); } else if(cnt == i + 1) { ans.push_back(M['B']); } else { ans.push_back(M['A']); } } } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:9: warning: control reaches end of non-void function [-Wreturn-type]
    9 |  string ans;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...