제출 #754129

#제출 시각아이디문제언어결과실행 시간메모리
754129kirakaminski968콤보 (IOI18_combo)C++17
5 / 100
1 ms240 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; string guess_sequence(int N){ string ask = "AB"; string now = ""; char arr[4] = {'A','B','X','Y'}; int ok = press(ask), used; if(ok == 2){ now += 'A'; used = 0; } else if(ok == 1){ ask = "A"; ok = press(ask); if(ok == 1) {now += 'A'; used = 0;} else {now += 'B'; used = 1;} } else{ ask = "X"; ok = press(ask); if(ok == 1) {now += 'X'; used = 2;} else {now += 'Y'; used = 3;} } int add; if(used == 0) add = 1; else add = 0; //cout << used << " " << add << "\n"; for(int i = 1;i<=N-2;++i){ string ask; string cur = now + arr[add]; int newc = -1, newc2 = -1; for(int j = 0;j<4;++j){ if(j != used){ ask += cur+arr[j]; if(newc == -1 && j != add) newc = j; else if(j != add) newc2 = j; } } ask += now+arr[newc]; ok = press(ask); if(ok == i+2){ now += arr[add]; } else if(ok == i+1){ now += arr[newc]; } else{ now += arr[newc2]; } } for(int i = 0;i<4;++i){ if(i != used){ ok = press(now+arr[i]); if(ok == N){ return now+arr[i]; } } } }

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

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