제출 #1006959

#제출 시각아이디문제언어결과실행 시간메모리
1006959devariaota콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define fi first #define se second #define endl '\n' template <typename T> using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>; const ll MOD = 1e9 + 7; const ll INF = 1e18; int n; string guess_sequence(int n){ string p = "AB", s = ""; if(press(p)){ p = "A"; if(press(p)) s += p; else s += "B"; } else { p = "X"; if(press(p)) s += p; else s += "Y"; } vector<char> ch; if(s[0] != 'A') ch.push_back('A'); if(s[0] != 'B') ch.push_back('B'); if(s[0] != 'X') ch.push_back('X'); if(s[0] != 'Y') ch.push_back('Y'); if(n % 2 == 0){ p = ""; p += s; p += ch[0]; p += s; p += ch[1]; if(press(p)){ p = s + ch[0]; if(press(p)){ s += ch[0]; } else { s += ch[1]; } } else { s += ch[2]; } } while(s.length() + 2 <= n){ p = ""; for(int i = 0; i < 3; i++){ p += s; p += s[0]; p += ch[i]; } p += s; p += ch[1]; if(press(p) == s.length() + 2){ s += ch[0]; } else if(press(p) == s.length() + 1){ s += ch[1]; } else { s += ch[2]; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:8: error: 'press' was not declared in this scope
   21 |     if(press(p)){
      |        ^~~~~
combo.cpp:43:12: error: 'press' was not declared in this scope
   43 |         if(press(p)){
      |            ^~~~~
combo.cpp:55:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |     while(s.length() + 2 <= n){
      |           ~~~~~~~~~~~~~~~^~~~
combo.cpp:66:12: error: 'press' was not declared in this scope
   66 |         if(press(p) == s.length() + 2){
      |            ^~~~~