제출 #191323

#제출 시각아이디문제언어결과실행 시간메모리
191323anubhavdhar콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 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_sequence(int N) { char P[3],c = guess_first_char(); ll i = 0,sz; string S = ""; S += c; for(char dd : {'A','B','X','Y'}) if (dd != c) P[i++] = dd; 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:53:16: error: 'guess_first_char' was not declared in this scope
   53 |  char P[3],c = guess_first_char();
      |                ^~~~~~~~~~~~~~~~
combo.cpp:63: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]
   63 |   if (sz == S.size())
      |       ~~~^~~~~~~~~~~
combo.cpp:65: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]
   65 |   else if(sz == S.size() + 1)
      |           ~~~^~~~~~~~~~~~~~~
combo.cpp:67: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]
   67 |   else if(sz == S.size() + 2)
      |           ~~~^~~~~~~~~~~~~~~