제출 #633497

#제출 시각아이디문제언어결과실행 시간메모리
633497anjamilicevic콤보 (IOI18_combo)C++14
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> #define IOS {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } #define pb push_back using namespace std; vector<char> v={'A', 'B', 'X', 'Y'}, w; string guess_sequence(int n) { string s=""; char x; string p="AB"; if(press(p)) { x='B'; if(press("A"))x='A'; } else { x='Y'; if(press("X"))x='X'; } s+=x; for(auto u:v) { if(u!=x)w.pb(u); } while(s.size() < n-1) { string q=s+w[0]+s+w[1]+w[0]+s+w[1]+w[1]+s+w[1]+w[2]; int cnt=press(q); int vel=s.size(); if(cnt == vel+1)s+=w[0]; else if(cnt == vel+2)s+=w[1]; else s+=w[2]; } char c=w[2]; if(n>1) { for(int i=0; i<2; i++) { string k=s+w[i]; if(press(k) == n) { c=w[i]; break; } } } s+=c; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     while(s.size() < n-1)
      |           ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...