제출 #95701

#제출 시각아이디문제언어결과실행 시간메모리
95701shenxy콤보 (IOI18_combo)C++11
30 / 100
85 ms424 KiB
#include "combo.h" #include <string> #include <algorithm> using namespace std; string guess_sequence(int N) { string p = ""; int K; char firstchar = ' '; for (int i = 1; i <= N; ++i) { p += "A"; if (i == 1 || firstchar != 'A') K = press(p); if (K < i) { p.pop_back(); p += "B"; } else { if (i == 1) firstchar = 'A'; continue; } if (i == 1 || firstchar != 'B') K = press(p); if (K < i) { p.pop_back(); if (firstchar == 'Y') { p += "X"; continue; } if (i == 1 || firstchar != 'X') p += "X"; else { p += "Y"; continue; } } else { if (i == 1) firstchar = 'B'; continue; } K = press(p); if (K < i) { p.pop_back(); p += "Y"; if (i == 1) firstchar = 'Y'; } else if (i == 1) firstchar = 'X'; } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: warning: 'K' may be used uninitialized in this function [-Wmaybe-uninitialized]
   12 |         if (K < i) {
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...