제출 #988701

#제출 시각아이디문제언어결과실행 시간메모리
988701Mighilon콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; #define trav(a, x) for(auto &a: x) #define sz(x) (int)x.size() string guess_sequence(int n){ string a="ABXY", b="AB", d, s; if(!press("AB")) d="XY"; char fc = b[0]; if(!press(b.substr(0, 1)) fc=b[1]; trav(c, a) if(c!=fc) d+=c; s+=fc; if(n<=1) return s; while(sz(s)<n-1) s+=d[press(s+d[1]+s+d[2]+d[0]+s+d[2]+d[1]+s+d[2]+d[2])-sz(s)]; if(press(s+d[0]+s+d[1])>sz(s)){ if(press(s+d[0])) return s+d[0]; return s+d[1]; } return s+d[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:30: error: expected ';' before 'fc'
   13 |     if(!press(b.substr(0, 1))
      |                              ^
      |                              ;
   14 |         fc=b[1];
      |         ~~                    
combo.cpp:13:8: warning: value computed is not used [-Wunused-value]
   13 |     if(!press(b.substr(0, 1))
      |        ^~~~~~~~~~~~~~~~~~~~~~
combo.cpp:5:20: error: expected primary-expression before 'for'
    5 | #define trav(a, x) for(auto &a: x)
      |                    ^~~
combo.cpp:15:5: note: in expansion of macro 'trav'
   15 |     trav(c, a)
      |     ^~~~
combo.cpp:14:17: error: expected ')' before 'for'
   14 |         fc=b[1];
      |                 ^
      |                 )
combo.cpp:13:7: note: to match this '('
   13 |     if(!press(b.substr(0, 1))
      |       ^