제출 #480652

#제출 시각아이디문제언어결과실행 시간메모리
480652couplefire콤보 (IOI18_combo)C++17
100 / 100
45 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string cur = ""; vector<string> c = {"A", "B", "X", "Y"}; if(press(c[0]+c[1])) if(press(c[0])) cur = c[0]; else cur = c[1], swap(c[0], c[1]); else if(press(c[2])) cur = c[2], swap(c[0], c[2]); else cur = c[3], swap(c[3], c[0]); if(n==1) return cur; for(int i = 2; i<=n-1; ++i){ int res = press(cur+c[1]+cur+c[2]+c[1]+cur+c[2]+c[2]+cur+c[2]+c[3]); if(res==cur.size()+1) cur += c[1]; else if(res==cur.size()+2) cur += c[2]; else cur += c[3]; } if(press(cur+c[1])==n) cur += c[1]; else if(press(cur+c[2])==n) cur += c[2]; else cur += c[3]; return cur; }

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

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