제출 #1023298

#제출 시각아이디문제언어결과실행 시간메모리
1023298vanea콤보 (IOI18_combo)C++14
10 / 100
65 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long; string guess_sequence(int n) { string pos = "ABXY"; char beg; for(auto it : pos) { string s(n, it); int k = press(s); if(k == 1) beg = it; } string ans(n, beg); int last = 1; for(int i = 1; i < n; i++) { for(auto it : pos) { if(it == beg) continue; ans[i] = it; int curr = press(ans); if(curr == last+1) break; } last++; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:13: warning: 'beg' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |             if(it == beg) continue;
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...