제출 #117123

#제출 시각아이디문제언어결과실행 시간메모리
117123exqt콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include <vector> #include <iostream> using namespace std; #include "combo.h" string guess_sequence(int N) { string S = ""; auto guess1 = [&S]() { if(press(S+"AB") > S.length()) if(press(S+"A") > S.length()) S += 'A'; else S += 'B'; else if(press(S+"X") > S.length()) S += 'X'; else S += 'Y'; }; guess1(); vector<char> candi; for(char c : "ABXY") { if(c != S[0]) candi.push_back(c); } auto guess2 = [&S, &candi]() { int t = press( S+candi[0]+candi[0]+ S+candi[0]+candi[1]+ S+candi[0]+candi[2]+ S+candi[1] ); if(t == S.length()+2) S += candi[0]; else if(t == S.length()+1) S += candi[1]; else S += candi[2]; }; for(int i=1; i<N-1; i++) guess2(); guess1(); return S; }

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

combo.cpp: In lambda function:
combo.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     if(press(S+"AB") > S.length())
      |        ~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |       if(press(S+"A") > S.length()) S += 'A'; else S += 'B';
      |          ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |       if(press(S+"X") > S.length()) S += 'X'; else S += 'Y';
      |          ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp: In lambda function:
combo.cpp:32:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     if(t == S.length()+2) S += candi[0];
      |        ~~^~~~~~~~~~~~~~~
combo.cpp:33:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     else if(t == S.length()+1) S += candi[1];
      |             ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...