제출 #995393

#제출 시각아이디문제언어결과실행 시간메모리
995393ducksaysquack콤보 (IOI18_combo)C++17
91 / 100
23 ms2048 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string c[7] = {"A","B","X","Y","A","B","X"}; string guess_sequence(int n) { string s; int k = 4; if(press("AB")) {if(press("A")) s = "A", k = 1; else s = "B", k = 2;} else if(press("X")) s = "X", k = 3; else s = "Y", k = 4; for(int i=0;i<3;i++) if(press(c[i])) s = c[i], k = i+1; while(s.size() < n-1) { int x = press(s+c[k]+s+c[k+1]+c[k]+s+c[k+1]+c[k+1]+s+c[k+1]+c[k+2]); if(x == s.size()+1) s += c[k]; else if (x == s.size()) s += c[k+2]; else s += c[k+1]; } if(n != 1) {for(int i=0;i<2;i++) if(press(s+c[i+k]) == n) return s+c[i+k]; return s+c[k+2];} return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |  while(s.size() < n-1) {
      |        ~~~~~~~~~^~~~~
combo.cpp:13:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   if(x == s.size()+1) s += c[k];
      |      ~~^~~~~~~~~~~~~
combo.cpp:14:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   else if (x == s.size()) s += c[k+2];
      |            ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...