Submission #534527

#TimeUsernameProblemLanguageResultExecution timeMemory
534527YaserFaisalCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string call( string cur , int siz , int n ) { int x , y ; if ( siz == n-1 ) { if ( cur[0] == "A" ) { x = press(cur+"B") ; y = press(cur+"X") ; if ( x == n ) return cur+"B" ; else if ( y == n ) return cur+"X" ; else return cur+"Y" ; } if ( cur[0] == "B" ) { x = press(cur+"A") ; y = press(cur+"X") ; if ( x == n ) return cur+"A" ; else if ( y == n ) return cur+"X" ; else return cur+"Y" ; } if ( cur[0] == "X" ) { x = press(cur+"B") ; y = press(cur+"A") ; if ( x == n ) return cur+"B" ; else if ( y == n ) return cur+"A" ; else return cur+"Y" ; } if ( cur[0] == "Y" ) { x = press(cur+"B") ; y = press(cur+"X") ; if ( x == n ) return cur+"B" ; else if ( y == n ) return cur+"X" ; else return cur+"A" ; } } if ( cur[0] == "A" ) { x = press(cur+"B"+cur+"XX"+cur+"XY"+cur+"XB") ; if ( x == siz+1 ) return cur+"B" ; else if ( x == siz+2 ) return cur+"X" ; else return cur+"Y" ; } if ( cur[0] == "B" ) { x = press(cur+"A"+cur+"XX"+cur+"XY"+cur+"XA") ; if ( x == siz+1 ) return cur+"A" ; else if ( x == siz+2 ) return cur+"X" ; else return cur+"Y" ; } if ( cur[0] == "X" ) { x = press(cur+"B"+cur+"AX"+cur+"AY"+cur+"AB") ; if ( x == siz+1 ) return cur+"B" ; else if ( x == siz+2 ) return cur+"A" ; else return cur+"Y" ; } if ( cur[0] == "Y" ) { x = press(cur+"B"+cur+"XX"+cur+"XY"+cur+"XB") ; if ( x == siz+1 ) return cur+"B" ; else if ( x == siz+2 ) return cur+"X" ; else return cur+"A" ; } } string guess_sequence (int n) { for ( int i = 0 ; i <= 2000 ; i++ ) { } string cur = "" ; int x = press("AB") ; if ( x == 0 ) { if ( press(cur+"X") == 1 ) cur+="X" ; else cur+="Y" ; } else { if ( press(cur+"A") == 1 ) cur+="A" ; else cur+="B" ; } while(cur.size()<) cur = call(cur,cur.size(),n) ; return cur ; }

Compilation message (stderr)

combo.cpp: In function 'std::string call(std::string, int, int)':
combo.cpp:11:21: warning: comparison with string literal results in unspecified behavior [-Waddress]
   11 |         if ( cur[0] == "A" )
combo.cpp:11:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:19:21: warning: comparison with string literal results in unspecified behavior [-Waddress]
   19 |         if ( cur[0] == "B" )
combo.cpp:19:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:27:21: warning: comparison with string literal results in unspecified behavior [-Waddress]
   27 |         if ( cur[0] == "X" )
combo.cpp:27:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:35:21: warning: comparison with string literal results in unspecified behavior [-Waddress]
   35 |         if ( cur[0] == "Y" )
combo.cpp:35:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:44:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
   44 |     if ( cur[0] == "A" )
combo.cpp:44:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:51:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
   51 |     if ( cur[0] == "B" )
combo.cpp:51:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:58:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
   58 |     if ( cur[0] == "X" )
combo.cpp:58:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp:65:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
   65 |     if ( cur[0] == "Y" )
combo.cpp:65:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:92:22: error: expected primary-expression before ')' token
   92 |     while(cur.size()<) cur = call(cur,cur.size(),n) ;
      |                      ^
combo.cpp: In function 'std::string call(std::string, int, int)':
combo.cpp:72:1: warning: control reaches end of non-void function [-Wreturn-type]
   72 | }
      | ^