제출 #94698

#제출 시각아이디문제언어결과실행 시간메모리
94698ToadDaveski콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { string s=""; map <char,ll> us; ll t1=press("AB"); if (t1) { if (press("A")) { us['A']=1; s="A"; } else { us['B']=1; s="B"; } } else { if (press("X")) { us['X']=1; s="X"; } else { us['Y']=1; s='Y'; } } vector <char> nx; if (!us['A']) nx.push_back('A'); if (!us['B']) nx.push_back('B'); if (!us['X']) nx.push_back('X'); if (!us['Y']) nx.push_back('Y'); for(i=2;i<N;i++) { string fp=""; fp=(s+nx[0]); fp+=(s+nx[1]+nx[0]); fp+=(s+nx[1]+nx[1]); fp+=(s+nx[1]+nx[2]); ll t=press(fp); if (t==i-1) s+=nx[2]; if (t==i) s+=nx[0]; if (t==i+1) s+=nx[1]; } if (press(s+nx[0])==N) s+=nx[0]; else { if (press(s+nx[1])==N) s+=nx[1]; else s+=nx[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:3: error: 'string' was not declared in this scope; did you mean 'std::string'?
    4 |   string s="";
      |   ^~~~~~
      |   std::string
In file included from /usr/include/c++/10/string:39,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
combo.cpp:5:3: error: 'map' was not declared in this scope
    5 |   map <char,ll> us;
      |   ^~~
combo.cpp:5:8: error: expected primary-expression before 'char'
    5 |   map <char,ll> us;
      |        ^~~~
combo.cpp:6:3: error: 'll' was not declared in this scope
    6 |   ll t1=press("AB");
      |   ^~
combo.cpp:7:7: error: 't1' was not declared in this scope; did you mean 'tm'?
    7 |   if (t1)
      |       ^~
      |       tm
combo.cpp:11:11: error: 'us' was not declared in this scope
   11 |           us['A']=1;
      |           ^~
combo.cpp:12:11: error: 's' was not declared in this scope
   12 |           s="A";
      |           ^
combo.cpp:16:11: error: 'us' was not declared in this scope
   16 |           us['B']=1;
      |           ^~
combo.cpp:17:11: error: 's' was not declared in this scope
   17 |           s="B";
      |           ^
combo.cpp:25:11: error: 'us' was not declared in this scope
   25 |           us['X']=1;
      |           ^~
combo.cpp:26:11: error: 's' was not declared in this scope
   26 |           s="X";
      |           ^
combo.cpp:30:11: error: 'us' was not declared in this scope
   30 |           us['Y']=1;
      |           ^~
combo.cpp:31:11: error: 's' was not declared in this scope
   31 |           s='Y';
      |           ^
combo.cpp:34:3: error: 'vector' was not declared in this scope
   34 |   vector <char> nx;
      |   ^~~~~~
combo.cpp:34:11: error: expected primary-expression before 'char'
   34 |   vector <char> nx;
      |           ^~~~
combo.cpp:35:8: error: 'us' was not declared in this scope
   35 |   if (!us['A']) nx.push_back('A');
      |        ^~
combo.cpp:35:17: error: 'nx' was not declared in this scope
   35 |   if (!us['A']) nx.push_back('A');
      |                 ^~
combo.cpp:36:8: error: 'us' was not declared in this scope
   36 |   if (!us['B']) nx.push_back('B');
      |        ^~
combo.cpp:36:17: error: 'nx' was not declared in this scope
   36 |   if (!us['B']) nx.push_back('B');
      |                 ^~
combo.cpp:37:8: error: 'us' was not declared in this scope
   37 |   if (!us['X']) nx.push_back('X');
      |        ^~
combo.cpp:37:17: error: 'nx' was not declared in this scope
   37 |   if (!us['X']) nx.push_back('X');
      |                 ^~
combo.cpp:38:8: error: 'us' was not declared in this scope
   38 |   if (!us['Y']) nx.push_back('Y');
      |        ^~
combo.cpp:38:17: error: 'nx' was not declared in this scope
   38 |   if (!us['Y']) nx.push_back('Y');
      |                 ^~
combo.cpp:39:7: error: 'i' was not declared in this scope
   39 |   for(i=2;i<N;i++)
      |       ^
combo.cpp:41:13: error: expected ';' before 'fp'
   41 |       string fp="";
      |             ^~~
      |             ;
combo.cpp:42:7: error: 'fp' was not declared in this scope
   42 |       fp=(s+nx[0]);
      |       ^~
combo.cpp:42:11: error: 's' was not declared in this scope
   42 |       fp=(s+nx[0]);
      |           ^
combo.cpp:42:13: error: 'nx' was not declared in this scope
   42 |       fp=(s+nx[0]);
      |             ^~
combo.cpp:46:9: error: expected ';' before 't'
   46 |       ll t=press(fp);
      |         ^~
      |         ;
combo.cpp:47:11: error: 't' was not declared in this scope
   47 |       if (t==i-1) s+=nx[2];
      |           ^
combo.cpp:48:11: error: 't' was not declared in this scope
   48 |       if (t==i) s+=nx[0];
      |           ^
combo.cpp:49:11: error: 't' was not declared in this scope
   49 |       if (t==i+1) s+=nx[1];
      |           ^
combo.cpp:51:13: error: 's' was not declared in this scope
   51 |   if (press(s+nx[0])==N)
      |             ^
combo.cpp:51:15: error: 'nx' was not declared in this scope
   51 |   if (press(s+nx[0])==N)
      |               ^~
combo.cpp:59:10: error: 's' was not declared in this scope
   59 |   return s;
      |          ^