제출 #633494

#제출 시각아이디문제언어결과실행 시간메모리
633494anjamilicevic콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#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++) { if(press(s+w[i]) == n)c=w[i]; break; } } s+=c; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:8: error: 'press' was not declared in this scope
   15 |     if(press(p))
      |        ^~~~~
combo.cpp:33:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |     while(s.size() < n-1)
      |           ~~~~~~~~~^~~~~
combo.cpp:36:17: error: 'press' was not declared in this scope
   36 |         int cnt=press(q);
      |                 ^~~~~
combo.cpp:49:16: error: 'press' was not declared in this scope
   49 |             if(press(s+w[i]) == n)c=w[i]; break;
      |                ^~~~~
combo.cpp:49:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   49 |             if(press(s+w[i]) == n)c=w[i]; break;
      |             ^~
combo.cpp:49:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   49 |             if(press(s+w[i]) == n)c=w[i]; break;
      |                                           ^~~~~