Submission #986835

#TimeUsernameProblemLanguageResultExecution timeMemory
986835LucaIlieCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include "combo.h" #include <iostream> using namespace std; char ch[4] = {'A', 'B', 'X', 'Y' }; string s; string guess_sequence( int n ) { int coins, i, first_letter, j, verific; for( i = 0; i < 4; i++ ) { s = ch[i]; if( press(s) == 1 ) first_letter = i; } s = ch[first_letter]; cout << s; for( i = 1; i < n; i++ ) { verific = 0; for( j = 0; j < 4; j++ ) { if( j == first_letter ) continue; if( verific < 2 ) { verific++; if( press(s + ch[j]) == i + 1 ) { s = s + ch[j]; //cout << ch[j]; break; } } else { s = s + ch[j]; //cout << ch[j]; break; } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:9: warning: unused variable 'coins' [-Wunused-variable]
    9 |     int coins, i, first_letter, j, verific;
      |         ^~~~~
combo.cpp:20:13: warning: 'first_letter' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |             if( j == first_letter )
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...