제출 #338202

#제출 시각아이디문제언어결과실행 시간메모리
338202zggf콤보 (IOI18_combo)C++14
10 / 100
76 ms440 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { char firstLetter; if(press("X")) firstLetter = 'X'; else if(press("Y")) firstLetter = 'Y'; else if(press("A")) firstLetter = 'A'; else if(press("B")) firstLetter = 'B'; string wyn = ""; wyn.push_back(firstLetter); for(int i = 1; i < N; i++){ if(firstLetter!='A'&&press(wyn+"A")-wyn.size()>0) {wyn.push_back('A'); continue;} if(firstLetter!='B'&&press(wyn+"B")-wyn.size()>0) {wyn.push_back('B'); continue;} if(firstLetter!='X'&&press(wyn+"X")-wyn.size()>0) {wyn.push_back('X'); continue;} if(firstLetter!='Y'&&press(wyn+"Y")-wyn.size()>0) {wyn.push_back('Y'); continue;} } return wyn; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:22: warning: 'firstLetter' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |   if(firstLetter!='B'&&press(wyn+"B")-wyn.size()>0) {wyn.push_back('B'); continue;}
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...