Submission #1196435

#TimeUsernameProblemLanguageResultExecution timeMemory
1196435ffeyyaae_Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence( int N ) { int N; cin >> N; string s = ""; string a = "ABXY"; vector<char> bt; if( press("A") > 0 ) s += "A"; else if( press("B") > 0 ) s += "B"; else if( press("X") > 0 ) s += "X"; else s += "Y"; if( N == 1 ) return s; for( auto c : a ) if( s[0] != c ) bt.push_back( c ); for( int i=1;i<N;i++ ) { string tp = s+bt[0] + s+bt[1]+bt[0] + s+bt[1]+bt[1] + s+bt[1]+bt[2]; int sz = sizeof(s); assert( sz < N*4 ); if( press(tp) == sz+1 ) s += bt[0]; else if( press(tp) == sz+2 ) s += bt[1]; else s += bt[2]; } if( press(s+bt[0]) == N ) s += bt[0]; else if( press(s+bt[1]) == N ) s += bt[1]; else s += bt[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:9: error: declaration of 'int N' shadows a parameter
    8 |     int N; cin >> N;
      |         ^
combo.cpp:6:28: note: 'int N' previously declared here
    6 | string guess_sequence( int N )
      |                        ~~~~^