제출 #1215066

#제출 시각아이디문제언어결과실행 시간메모리
1215066LM1Combo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define ff first #define ss second #define pb push_back #define vi vector<int> #define fr(i,ii,iii) for(int i=ii;i<iii;i++) #include "combo.h" string guess_sequence(int N){ string ans=""; int x; x=press("AB"); if(x==2)ans="A"; else if(x==1){ x=press("A"); if(x==1){ ans="A"; } else ans="B"; } else{ x=press("X"); if(x==1){ ans="X"; } else ans="Y"; } string a; vector<char>v={'A','B','C','D'}; fr(i,0,4){ if(v[i]==ans[0]){ v.erase(v.begin()+i); break; } } fr(i,2,n){ a=ans; a+=v[0]; a+=ans; a+=v[1];a+=v[0]; a+=v[1];a+=v[1]; a+=v[1];a+=v[2]; x=press(a); if(x==ans.size()){ ans+=v[2]; continue; } if(x==ans.size()+1){ ans+=v[0]; continue; } if(x==ans.size()+2){ ans+=v[1]; continue; } } a=ans; a+=v[0]; x=press(a); if(x==ans.size()+1){ return a; } else{ a=ans; a+=v[1]; x=press(a); if(x==ans.size()+1){ return a; } else{ ans+=v[2]; return ans; } } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:16: error: 'n' was not declared in this scope
   38 |         fr(i,2,n){
      |                ^
combo.cpp:9:37: note: in definition of macro 'fr'
    9 | #define fr(i,ii,iii) for(int i=ii;i<iii;i++)
      |                                     ^~~