제출 #191327

#제출 시각아이디문제언어결과실행 시간메모리
191327anubhavdhar콤보 (IOI18_combo)C++14
100 / 100
53 ms540 KiB
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<n;i++) #define FORe(i,n) for(i=1;i<=n;i++) #define FORr(i,a,b) for(i=a;i<b;i++) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> using namespace std; #include "combo.h" /* const ll MAXN = 2e5+5; const ll MOD = 1e9+7; const ll ROOTN = 320; const ll LOGN = 17; const ll INF = 1e17 + 1101; inline int press(string S) { cout<<"pressing : "<<S<<endl; ll p; cin>>p; return p; } */ char guess_first_char() { ll i = press("XY"); if (i) { if (press("X")) return 'X'; return 'Y'; } else { if (press("A")) return 'A'; return 'B'; } } string guess_second_char(char g,char a,char b,char c) { string s = ""; s += g; if (press(s+a) == 2) return s+a; if (press(s+b) == 2) return s+b; return s+c; } string guess_sequence(int N) { if (N==0) return ""; char P[3],c = guess_first_char(); ll i = 0,sz; string S = ""; S += c; if (N == 1) return S; for(char dd : {'A','B','X','Y'}) if (dd != c) P[i++] = dd; if (N == 2) return guess_second_char(c,P[1],P[2],P[0]); FORe(i,N-2) { sz = press(S+P[0]+S+P[1]+P[0]+S+P[1]+P[1]+S+P[1]+P[2]); if (sz == S.size()) S += P[2]; else if(sz == S.size() + 1) S += P[0]; else if(sz == S.size() + 2) S += P[1]; else return "SHOULDNOTBEOUTPUT"; } if (N == press(S+P[0])) S+=P[0]; else if(N == press(S+P[1])) S+=P[1]; else S+=P[2]; return S; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll N; cin>>N; cout<<"output :"<<guess_sequence(N); return 0; }*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:80:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |   if (sz == S.size())
      |       ~~~^~~~~~~~~~~
combo.cpp:82:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |   else if(sz == S.size() + 1)
      |           ~~~^~~~~~~~~~~~~~~
combo.cpp:84:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |   else if(sz == S.size() + 2)
      |           ~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...