제출 #140773

#제출 시각아이디문제언어결과실행 시간메모리
140773caoash콤보 (IOI18_combo)C++14
0 / 100
2 ms280 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string soFar; string first = "A"; if(press("B")){ first = "B"; } else if(press("Y")){ first = "Y"; } else if(press("X")){ first = "X"; } soFar += first; string c1,c2,c3; if(first == "A"){ c1 = "X"; c2 = "Y"; c3 = "B"; } else if(first == "B"){ c1 = "X"; c2 = "Y"; c3 = "A"; } else if(first == "X"){ c1 = "B"; c2 = "Y"; c3 = "A"; } else if(first == "Y"){ c1 = "X"; c2 = "B"; c3 = "A"; } for(int i = 0; i < N-1; i++){ int val = press(soFar + c1 + c1 + soFar + c2); if(val == soFar.size()){ soFar += c3; } else if(val == soFar.size()+1){ soFar += c2; } else{ soFar += c1; } } return soFar; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   if(val == soFar.size()){
      |      ~~~~^~~~~~~~~~~~~~~
combo.cpp:37:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   else if(val == soFar.size()+1){
      |           ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...