제출 #380429

#제출 시각아이디문제언어결과실행 시간메모리
380429Dan4Life콤보 (IOI18_combo)C++17
5 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p = "AB", temp = "ABXY", x = ""; if(!press(p))p="XY"; if(!press(p.substr(0,1)))p=p[1]; else p = p[0]; for(auto u : temp) if(p[0]!=u)x+=u; for(int i = 1; i < N-1; i++) { int num = press(p+x[0]+p+x[1]+x[0]+p+x[1]+x[1]+p+x[1]+x[2]); if(num==p.size()) p+=x[2]; else if(num==p.size()+1)p+=x[0]; else p+=x[1]; } if(press(p+x[0]+p+x[1])==p.size())p+=x[2]; else if(press(p+x[0])==p.size()+1)p+=x[0]; else p+=x[1]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:13: 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(num==p.size()) p+=x[2];
      |          ~~~^~~~~~~~~~
combo.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |       else if(num==p.size()+1)p+=x[0];
      |               ~~~^~~~~~~~~~~~
combo.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   if(press(p+x[0]+p+x[1])==p.size())p+=x[2];
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:19:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   else if(press(p+x[0])==p.size()+1)p+=x[0];
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...