제출 #925935

#제출 시각아이디문제언어결과실행 시간메모리
925935HuyQuang_re_Zero콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define db long double #define N 505 #define II pair <ll,ll> #define III pair <ll,II> #define IV pair <vector <int>,vector <int> > #define IDB pair <db,int> #define TII pair <treap*,treap*> #define fst first #define snd second #define BIT(x,i) ((x>>i)&1) #define pi acos(-1) #define to_radian(x) (x*pi/180.0) #define to_degree(x) (x*180.0/pi) #define Log(x) (31-__builtin_clz((int)x)) #define LogLL(x) (63-__builtin_clzll((ll)x) using namespace std; #include "combo.h" //#define press(s) IR.cal(s) struct Interactive { int n; string s; void Init(int _n) { n=_n; cin>>s; } int cal(string a) { for(int i=n;i>=1;i--) if(a.find(s.substr(0,i))!=a.npos) return i; return 0; } } IR; string guess_sequense(int _n) { int n=_n; if(n==1) { if(press("A")) return "A"; if(press("B")) return "B"; if(press("X")) return "X"; return "Y"; } string s; int k=press("BXBY"); if(k==0) s="A"; else if(k==1) { k=press("BAX"); if(k==0) s="Y"; else if(k==1) s="X"; else s="B"; } else s=(press("B") ? "B" : "X"); string t; if(s=="A") t="BXY"; else if(s=="B") t="XYA"; else if(s=="X") t="YAB"; else t="ABX"; for(int i=2;i<n;i++) { string now=""; now+=s; now+=t[0]; now+=s; now+=t[1]; now+=t[0]; now+=s; now+=t[1]; now+=t[1]; now+=s; now+=t[1]; now+=t[2]; k=press(now); if(k==s.size()) s+=t[2]; else if(k==s.size()+2) s+=t[1]; else s+=t[0]; } if(press(s+t[0])==n) s+=t[0]; else if(press(s+t[1])==n) s+=t[1]; else s+=t[2]; return s; } /* int main() { freopen("combo.inp","r",stdin); freopen("combo.out","w",stdout); int n; cin>>n; IR.Init(n); cout<<guess_sequense(n); } */

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

combo.cpp:4:11: error: expected ',' or '...' before numeric constant
    4 | #define N 505
      |           ^~~
combo.h:5:32: note: in expansion of macro 'N'
    5 | std::string guess_sequence(int N);
      |                                ^
combo.cpp: In function 'std::string guess_sequense(int)':
combo.cpp:73:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |         if(k==s.size()) s+=t[2];
      |            ~^~~~~~~~~~
combo.cpp:74:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |         else if(k==s.size()+2) s+=t[1];
      |                 ~^~~~~~~~~~~~