제출 #241995

#제출 시각아이디문제언어결과실행 시간메모리
241995Fasho콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout); #define mod 1000000007 #define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i] #define fo(i,x,y) for(ll i=x;i<=y;i++) #define INF 1000000000005 #define ull unsigned long long int #include "combo.h" using namespace std; ll n,m,sum,t; // constexpr int MAX_N = 2000; // constexpr int MAX_NUM_MOVES = 8000; // int N; // std::string S; string tut="ABXY"; string s; // char tutt; // ll tutmac; // int num_moves; // namespace { // void wrong_answer(const char *MSG) { // printf("Wrong Answer: %s\n", MSG); // exit(0); // } // } // int press(std::string p) { // if (++num_moves > MAX_NUM_MOVES) { // wrong_answer("too many moves"); // } // int len = p.length(); // if (len > 4 * N) { // wrong_answer("invalid press"); // } // for (int i = 0; i < len; ++i) { // if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') { // wrong_answer("invalid press"); // } // } // int coins = 0; // for (int i = 0, j = 0; i < len; ++i) { // if (j < N && S[j] == p[i]) { // ++j; // } else if (S[0] == p[i]) { // j = 1; // } else { // j = 0; // } // coins = std::max(coins, j); // } // return coins; // } string f1() { string ss="AB";; ll a=press(ss); ss="AX"; ll b=press(ss); if(a) { if(b) return "A"; return "B"; } if(b) return "X"; return "Y"; } string end() { // cout<<s<<endl; string ss=s+"A"+s+"B"; ll a=press(ss); ss=s+"A"+s+"X"; ll b=press(ss); if(a==n) { if(b==n) return "A"; return "B"; } if(b==n) return "X"; return "Y"; } ll ask1() { string p=""; fo(i,0,3) { if(tutmac==i) continue; p=p+s+"A"+tut[i]; } p=p+s+"B"; return press(p)-s.size(); } ll ask2() { string p=""; fo(i,0,3) { if(tutmac==i) continue; p=p+s+"X"+tut[i]; } p=p+s+"Y"; return press(p)-s.size(); } void ask() { fo(i,0,3) if(s[0]==tut[i]) tutmac=i; // cout<<tutmac<<endl; ll x=0; if(tutmac>=2) { x=ask1(); ll y=2; if(tutmac==y) y++; if(x==0) { s+=tut[y]; } if(x==1) s+=tut[1]; if(x==2) s+=tut[0]; return; } x=ask2(); cout<<x<<endl; ll y=0; if(y==tutmac) y++; if(x==0) { s+=tut[y]; } if(x==1) s+=tut[3]; if(x==2) s+=tut[2]; } string guess_sequence(int nn) { n=nn; s=f1(); tutmac=s[0]; string p = s; // cout<<s<<endl; fo(i,2,n-1) { ask(); } // cout<<s<<endl; string xx=end(); s=s+xx; // cout<<s<<endl; return s; } // int main() { // char buffer[MAX_N + 1]; // if (scanf("%s", buffer) != 1) { // fprintf(stderr, "Error while reading input\n"); // exit(1); // } // S = buffer; // N = S.length(); // num_moves = 0; // std::string answer = guess_sequence(N); // if (answer != S) { // wrong_answer("wrong guess"); // exit(0); // } // printf("Accepted: %d\n", num_moves); // return 0; // }

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

combo.cpp: In function 'long long int ask1()':
combo.cpp:109:6: error: 'tutmac' was not declared in this scope
  109 |   if(tutmac==i)
      |      ^~~~~~
combo.cpp: In function 'long long int ask2()':
combo.cpp:121:6: error: 'tutmac' was not declared in this scope
  121 |   if(tutmac==i)
      |      ^~~~~~
combo.cpp: In function 'void ask()':
combo.cpp:133:4: error: 'tutmac' was not declared in this scope
  133 |    tutmac=i;
      |    ^~~~~~
combo.cpp:136:5: error: 'tutmac' was not declared in this scope
  136 |  if(tutmac>=2)
      |     ^~~~~~
combo.cpp:155:8: error: 'tutmac' was not declared in this scope
  155 |  if(y==tutmac)
      |        ^~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:174:2: error: 'tutmac' was not declared in this scope
  174 |  tutmac=s[0];
      |  ^~~~~~