제출 #103627

#제출 시각아이디문제언어결과실행 시간메모리
103627medk콤보 (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ll long long string guess_sequence(int N) { string ans=""; char ci[4]={'A','B','X','Y'}; char c[3]; if(press("AB")>0) { if(press("A")>0) ans="A"; else ans="B"; } else { if(press("X")>0) ans="X"; else ans="Y"; } int ind=0; for(int i=0;i<4;i++) { if(ans[0]!=ci[i]) { c[ind]=ci[i]; ind++; } } for(int i=0;i<N-2;i++) { string pr=ans+c[0]+ans+c[1]+c[0]+ans+c[1]+c[1]+ans+c[1]+c[2]; int get=press(pr); if(get==ans.length()) { ans+=c[2]; } else if(get==ans.length()+1) { ans+=c[0]; } else { ans+=c[1]; } } if(press(ans+c[0])==N) ans+=c[0]; else if(press(ans+c[1])==N) ans+=c[1]; else ans+=c[2]; return ans; }

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

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