Submission #1007142

#TimeUsernameProblemLanguageResultExecution timeMemory
1007142christinelynnCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" string guess_sequence ( int n ){ string s = ""; string temp = "AB"; int y = press(temp); if ( y == 1 || y == 2 ){ temp = "A"; y = press ( temp ); if ( y == 1 ) s = "A"; else s = "B"; } else{ temp = "X"; y = press ( temp ); if ( y == 1 ) s = "X"; else s = "Y"; } for ( int i = 1; i <= n - 2; i++ ){ string t1, t2, t3, t4; if ( s[0] == 'A' ){ t1 = s; t1 += 'B'; t2 = s; t2 += "XX"; t3 = s; t3 += "XY"; t4 = s; t4 += "XB"; temp = t1 + t2 + t3 + t4; y = press ( temp ); if ( y == s.length()) s += 'Y'; else if ( y == s.length() + 1) s += 'B'; else s += 'X'; } else if ( s[0] == 'B'){ t1 = s; t1 += 'A'; t2 = s; t2 += "XX"; t3 = s; t3 += "XY"; t4 = s; t4 += "XA"; temp = t1 + t2 + t3 + t4; y = press ( temp ); if ( y == s.length()) s += 'Y'; else if ( y == s.length() + 1) s += 'A'; else s += 'X'; } else if ( s[0] == 'X'){ t1 = s; t1 += 'A'; t2 = s; t2 += "BB"; t3 = s; t3 += "BY"; t4 = s; t4 += "BA"; temp = t1 + t2 + t3 + t4; y = press ( temp ); if ( y == s.length()) s += 'Y'; if ( y == s.length() + 1) s += 'A'; if ( y == s.length() + 2 ) s += 'B'; } else if ( s[0] == 'Y' ){ t1 = s; t1 += 'B'; t2 = s; t2 += "XB"; t3 = s; t3 += "XA"; t4 = s; t4 += "XX"; temp = t1 + t2 + t3 + t4; y = press ( temp ); if ( y == s.length() ) s += 'A'; if ( y == s.length() + 1) s += 'B'; if ( y == s.length() + 2 ) s += 'X'; } } if ( s[0] == 'A' ){ temp = "B"; y = press(temp); if ( y == s.length() + 1) s += 'B'; else{ temp = "X"; y = press ( temp ); if ( y == s.length() + 1) s += 'X'; else s += 'Y'; } } else if ( s[0] == 'B' ){ temp = "A"; y = press ( temp ); if ( y == s.length() + 1) s += 'A'; else{ temp = "X"; y = press ( temp ); if ( y == s.length() + 1) s += 'X'; else s += 'Y'; } } else if ( s[0] == 'X' ){ temp = "A"; y = press ( temp ); if ( y == s.length() + 1) s += 'A'; else{ temp = "B"; y = press ( temp ); if ( y == s.length() + 1) s += 'B'; else s += 'Y'; } } else if ( s[0] == 'Y'){ temp = "A"; y = press ( temp ); if ( y == s.length() + 1) s += 'A'; else{ temp = "B"; y = press ( temp ); if ( y == s.length() + 1) s += 'B'; else s += 'X'; } } return s; }

Compilation message (stderr)

combo.cpp:3:1: error: 'string' does not name a type; did you mean 'stdin'?
    3 | string guess_sequence ( int n ){
      | ^~~~~~
      | stdin