제출 #857007

#제출 시각아이디문제언어결과실행 시간메모리
857007chrispham258콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
/* Pham Ngoc Tho aka Chis Pham */ /* [Author : Pham Ngoc Tho] - THPT Chuyen Nguyen Du */ /* [ 2024 - 12TH GO VOI 24 ] - From Nguyen Du with love */ // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> // #include<combo.h> using namespace std; #define oo 0x3f #define ff first #define ss second #define endl "\n" #define ins insert #define chis id<<1 #define pham (id<<1) + 1 #define sqr(x) ((x) * 1ll * (x)) #define gcd(a, b) __gcd(a, b) #define pb push_back #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(),x.rend() #define repu(i, x, n) for(int i = x; i <= n; ++i) #define repd(i, n, x) for(int i = n; i >= x; --i) #define reset(x, val) memset(x, val, sizeof(x)) typedef double db; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll, ll> pll; template<class T> bool getbit(T val, int i) { return (val >> i) & 1; } template<class T> int cntbit(T val) { return val == 0 ? 0 : cntbit(val >> 1) + (val & 1); } template<class T> ll fpow(T a, const T b) { ll res = 1, x = a, y = b; while(y){if(y & 1)res *= x; x = x * x; y>>=1;}; return res; } template<class T> ll modfpow(T a, T b, const T &m) { ll res = 1, x = a, y = b; x %= m; while(y){if(y & 1){res *= x; res %= m;}; x = x * x; x %= m; y >>= 1; } return res % m; } template<class T> T lcm(T &a, T &b) { return a / gcd(a, b) * b; } const int mod = 1e9 + 7; const int INF = 1e9 + 7; const ll LNF = 1e18 + 7; inline char gc() { static char buf[1 << 23]; static size_t bc, be; if(bc >= be){ buf[0] = 0, bc = 0; be = fread(buf, 1, sizeof(buf), stdin); } return buf[bc++]; } ll readLL() { ll a, c; while ((a = gc()) < 20); if (a == '-') return -readLL(); while ((c = gc()) >= 48) a = a * 10 + c - 480; return a - 48; } int readInt() { int a, c; while ((a = gc()) < 10); if (a == '-') return -readInt(); while ((c = gc()) >= 48) a = a * 10 + c - 480; return a - 48; } mt19937 RND(time(nullptr)); ll rnd(ll l, ll r) { assert(l <= r);ll L = l, R = r; ll aft = (L + RND() * 1LL % (R - L + 1)); return aft; } #define TASK "name" #define FILE "DEBUG" void setIO() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); } template<class T> T multi(const T &a, const T &b) { T res = (a*b)%mod; return res;} template<class T> bool umax(T &a, T b) { if(a < b){ a = b; return 1;} else return 0;} template<class T> bool umin(T &a, T b) { if(a > b){ a = b; return 1;} else return 0;} const int NmX = 1e5 + 7; const int dx[] = {0, 0, 1, -1}; const int dy[] = {1, -1, 0, 0}; // int press(string s){ // cout<<s<<endl; // int val;cin>>val;return val; // } string guess_sequence(int N){ string c[] = {"A", "B", "X", "Y"}; string ans = "", temp = ""; if(press("AB")){ if(press("A")) ans += 'A'; else ans += 'B'; }else if(press("X")) ans += 'X'; else ans += 'Y'; repu(i, 0, 3) if(ans != c[i]) temp += c[i]; repu(i, 1, N - 1){ string s = ans + temp[0] + temp[0] + ans + temp[0] + temp[1] + ans + temp[0] + temp[2] + ans + temp[1]; int len = press(s); if(len = i + 2) ans += temp[0]; else if(len == i + 1) ans += temp[1]; else ans += temp[2]; } if(N >= 2){ if(press(ans + temp[0]) == N){ ans += temp[0]; }else if(press(ans + temp[1]) ==N){ ans += temp[1]; }else ans += temp[2]; } return ans; } // main(){ // cout<< guess_sequence(5); // }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:80:6: error: 'press' was not declared in this scope
   80 |   if(press("AB")){
      |      ^~~~~
combo.cpp:90:15: error: 'press' was not declared in this scope
   90 |     int len = press(s);
      |               ^~~~~
combo.cpp:91:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   91 |     if(len = i + 2) ans += temp[0];
      |        ~~~~^~~~~~~
combo.cpp:97:8: error: 'press' was not declared in this scope
   97 |     if(press(ans + temp[0]) == N){
      |        ^~~~~