Submission #255441

#TimeUsernameProblemLanguageResultExecution timeMemory
255441lakshith_Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" std::std::string l; std::string guess_sequence(int n){ int start = ' '; std::string r = ""; if(press("A")){ r += 'A'; l = "BXY"; }else if(press("B")){ r += 'B'; l = "AXY"; }else if(press("X")){ r += 'X'; l = "BAY"; }else{ r += 'Y'; l = "ABX"; } if(n==1)return r; int k = 1; for(int i=1;i<n-1;i++){ std::string a,b,c,d; a = r + l[0]+l[0]; b = r + l[0]+l[1]; c = r + l[0]+l[2]; d = r + l[1]; int p = press(a+b+c+d); p -= k; if(p==0){ r += l[2]; }else if(p==1){ r += l[1]; }else { r += l[0]; } k++; } for(int i=0;i<3;i++){ if(press(r+l[i])==n){ r += l[i]; break; } } return r; }

Compilation message (stderr)

combo.cpp:4:6: error: 'std' in namespace 'std' does not name a type
    4 | std::std::string l;
      |      ^~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: error: 'l' was not declared in this scope
   12 |         l = "BXY";
      |         ^
combo.cpp:15:9: error: 'l' was not declared in this scope
   15 |         l = "AXY";
      |         ^
combo.cpp:18:9: error: 'l' was not declared in this scope
   18 |         l = "BAY";
      |         ^
combo.cpp:21:9: error: 'l' was not declared in this scope
   21 |         l = "ABX";
      |         ^
combo.cpp:27:17: error: 'l' was not declared in this scope
   27 |         a = r + l[0]+l[0];
      |                 ^
combo.cpp:44:20: error: 'l' was not declared in this scope
   44 |         if(press(r+l[i])==n){
      |                    ^
combo.cpp:8:9: warning: unused variable 'start' [-Wunused-variable]
    8 |     int start = ' ';
      |         ^~~~~