제출 #1250321

#제출 시각아이디문제언어결과실행 시간메모리
1250321ubormaci콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> // for sort, mainly #include <vector> #include <map> #include <set> #include <cmath> #include <array> #include <string> #include <cstdio> #include <iterator> #include <unordered_set> #include <cstdint> // for int64_t, int32_t, etc #include <queue> #include <stack> #include <deque> #include <numeric> // gcd, lcm #include <fstream> #include <bitset> // for bitset #include <iomanip> #include <cassert> // for set with custom ordering #include <type_traits> // for set with custom ordering #include <utility> // for swap, forward, etc using namespace std; #pragma GCC optimize("O2") // #pragma GCC optimize("O1","O2","O3","Ofast","unroll-loops") //#pragma GCC target("sse","sse2","sse3","sse4.1","sse4.2","avx","avx2","fma") template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cout << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); } #ifdef LOCAL #define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif /* notes: int64_t stoi(string s) -> string to int to_string() -> int (or else) to string vector declaration: vector<ll> v(n, 0) vector<vector<ll>> v(n, vector<ll>(n, 0)); {if statement} ? {truth value} : {false value} set lower bound/upper bound: // . . . m1 . . . d . . . . m2 auto m1_it = b.lower_bound(d); advance(m1_it, -1); m1 = *m1_it; m2 = *b.upper_bound(d); #ifdef LOCAL freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif constexpr auto lcm(auto x, auto... xs) { return ((x = std::lcm(x, xs)), ...); } std::gcd(int a, int b) cout << setprecision(n); set with custom ordering set<ll, decltype(&cmp)> qu(cmp); */ typedef int64_t ll; string guess_sequence(int N) { ll n = N; string ans = ""; // a lenyeg az, hogy hatarozzuk meg, melyik a legelso karakter ll first = -1; vector<char> v(4, 'z'); v[0] = 'A'; v[1] = 'B'; v[2] = 'X'; v[3] = 'Y'; for(ll i = 0; i < 4; i++) { string temp = "" + v[i]; ll g = press(temp); if(g == 1) { first = i; ans += v[i]; break; } } for(ll i = 2; i <= n; i++) { for(ll j = 0; j < 4; j++) { if(j == first) { continue; } string temp = ans + v[j]; ll g = press(temp); if(g == i) { ans = temp; break; } } } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:98:16: error: 'press' was not declared in this scope
   98 |         ll g = press(temp);
      |                ^~~~~
combo.cpp:117:20: error: 'press' was not declared in this scope
  117 |             ll g = press(temp);
      |                    ^~~~~