제출 #203863

#제출 시각아이디문제언어결과실행 시간메모리
203863staniewzki콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; ostream& operator<<(ostream &out, string str) { for(char c : str) out << c; return out; } template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) { return out << "(" << p.first << ", " << p.second << ")"; } template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) { out << "{"; for(auto it = a.begin(); it != a.end(); it = next(it)) out << (it != a.begin() ? ", " : "") << *it; return out << "}"; } void dump() { cerr << "\n"; } template<class T, class... Ts> void dump(T a, Ts... x) { cerr << a << ", "; dump(x...); } #ifdef DEBUG # define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__) #else # define debug(...) false #endif #define REP(i, n) for(int i = 0; i < n; i++) #define FOR(i, a, b) for(int i = a; i <= b; i++) #define ST first #define ND second template<class T> int size(T && a) { return a.size(); } using LL = long long; using PII = pair<int, int>; mt19937 rng(2137); int rd(int a, int b) { return uniform_int_distribution<int>(a, b)(rng); } string guess_sequence(int n) { string guess(n, 'A'); if(press("AB")) { if(press("A")) guess[0] = 'A'; else guess[0] = 'B'; } else { if(press("X")) guess[0] = 'X'; else guess[0] = 'Y'; } auto letter_id = [&](char c) { REP(i, 4) if("ABXY"[i] == c) return i; }; auto get_letter = [&](vector<bool> banned) { int x; do x = rd(0, 3); while(!banned[x]); return "ABXY"[x]; }; vector<bool> used(4); used[letter_id(guess[0])] = true; FOR(i, 1, n - 1) guess[i] = get_letter(used); int cur = 1; FOR(i, 1, n - 1) { auto banned = used; while(cur <= i) { banned[letter_id(guess[i])] = true; guess[i] = get_letter(banned); cur = press(guess); } } return guess; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:5: error: 'press' was not declared in this scope
   49 |  if(press("AB")) {
      |     ^~~~~
combo.cpp:81:10: error: 'press' was not declared in this scope
   81 |    cur = press(guess);
      |          ^~~~~
combo.cpp: In lambda function:
combo.cpp:61:2: warning: control reaches end of non-void function [-Wreturn-type]
   61 |  };
      |  ^