제출 #916923

#제출 시각아이디문제언어결과실행 시간메모리
916923manishjha91콤보 (IOI18_combo)C++17
0 / 100
2 ms696 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ vector<char> v = {'A','B','X','Y'}; string s = ""; int f = -1; for(int i=0; i<2; i++) { if(f!=-1) break; string curr = ""+string(1,v[2*i]) + string(1,v[2*i+1]); if(press(curr)) { for(int j=0; j<2; j++) { if(press(string(1,v[2*i+j]))) { f = 2*i + j; break; } } } } s.push_back(v[f]); swap(v[f],v.back()); v.pop_back(); while(s.size()<N) { int n = s.size(); string s1 = s; string s2 = s; string s3 = s; string s4 = s; if(n==N-1) { s1.push_back(v[0]); s2.push_back(v[1]); s3.push_back(v[2]); if(press(s1)==N) { return s1; } if(press(s2)==N) { return s2; } return s3; } s1+=v[0]+v[0]; s2+=v[0]+v[1]; s3+=v[0]+v[2]; s4+=v[1]; string curr = s1 + s2 + s3 + s4; int cnt = press(curr); if(cnt==n+2) { s.push_back(v[0]); } else if(cnt==n+1) s.push_back(v[1]); else s.push_back(v[2]); } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |  while(s.size()<N)
      |        ~~~~~~~~^~
combo.cpp:6:35: warning: control reaches end of non-void function [-Wreturn-type]
    6 |  vector<char> v = {'A','B','X','Y'};
      |                                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...