제출 #403439

#제출 시각아이디문제언어결과실행 시간메모리
403439InternetPerson10Combo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <string> using namespace std; string guess_sequence(int N) { vector<string> c; c.push_back("A"); c.push_back("B"); c.push_back("X"); c.push_back("Y"); string s, ss; int co, a, b, d; a = b = d = 1; s = c[0] + c[1]; co = press(s); if(co > 0) { co = press(c[0]); if(co > 0) s = c[0]; else s = c[1]; } else { co = press(c[2]); if(co > 0) s = c[2]; else s = c[3]; } for(int i = 0; i < 4; i++) { if(s == c[i]) { a = (i+1)%4; b = (i+2)%4; d = (i+3)%4; } } for(int i = 1; i < N-1; i++) { string s1 = s + c[a] + c[a]; string s2 = s + c[a] + c[b]; string s3 = s + c[a] + c[d]; string s4 = s + c[b]; ss = s1 + s2 + s3 + s4; co = press(ss); if(co == i+2) s = s + c[a]; else if(co == i+1) s = s + c[b]; else s = s + c[d]; } ss = s + c[a]; co = press(ss); if(co == N) s = s + c[a]; else { ss = s + c[b]; co = press(ss); if(co == N) s = s + c[b]; else s = s + c[d]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:2: error: 'vector' was not declared in this scope
    8 |  vector<string> c;
      |  ^~~~~~
combo.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "combo.h"
  +++ |+#include <vector>
    2 | #include <string>
combo.cpp:8:15: error: expected primary-expression before '>' token
    8 |  vector<string> c;
      |               ^
combo.cpp:8:17: error: 'c' was not declared in this scope
    8 |  vector<string> c;
      |                 ^