제출 #483011

#제출 시각아이디문제언어결과실행 시간메모리
483011Spade1콤보 (IOI18_combo)C++14
100 / 100
36 ms640 KiB
#include <bits/stdc++.h> #include "combo.h" #define ll long long #define pii pair<int, int> #define st first #define nd second #define pb push_back using namespace std; string guess_sequence(int N) { char first; if (press("AB")) { if (press("A")) first = 'A'; else first = 'B'; } else { if (press("X")) first = 'X'; else first = 'Y'; } if(N == 1){ string tmp(1, first); return tmp; } string ans(N, first); string s(4*N, first); vector<char> rem; if (first != 'A') rem.pb('A'); if (first != 'B') rem.pb('B'); if (first != 'X') rem.pb('X'); if (first != 'Y') rem.pb('Y'); for (int i = 1; i < N - 1; ++i) { s[i] = rem[0]; s[N + i] = rem[0]; s[2*N + i] = rem[0]; s[3*N + i] = rem[1]; s[i + 1] = rem[0]; s[N + i + 1] = rem[1]; s[2*N + i + 1] = rem[2]; int ret = press(s), c; if (ret == i) c = 2; if (ret == i + 1) c = 1; if (ret == i + 2) c = 0; s[i] = rem[c]; s[N + i] = rem[c]; s[2*N + i] = rem[c]; s[3*N + i] = rem[c]; ans[i] = rem[c]; } ans[N - 1] = rem[0]; if (press(ans) == N) return ans; ans[N - 1] = rem[1]; if (press(ans) == N) return ans; ans[N - 1] = rem[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:21: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   49 |         s[i] = rem[c];
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...