Submission #109613

#TimeUsernameProblemLanguageResultExecution timeMemory
109613polyfishCombo (IOI18_combo)C++14
0 / 100
4 ms452 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; char C[] = {'A', 'B', 'X', 'Y'}; string S; bool find_first_two_char(int x) { int tmp = press(string()+C[x]+C[x+1]); if (tmp==0) return false; if (tmp==1) { if (press(string()+C[x])==1) S += C[x]; else S += C[x+1]; if (press(S+C[(x+2)%4])==2) S += C[(x+2)%4]; else S += C[(x+3)%4]; } else if (tmp==2) { if (press(string()+C[x])==1) S = S + C[x] + C[x+1]; else S = S + C[x+1] + C[x]; } return true; } string guess_sequence(int N) { if (!find_first_two_char(0)) find_first_two_char(2); // cerr << S << '\n'; for (int i=0; i<4; ++i) { if (C[i]==S[0]) swap(C[i], C[0]); } for (int i=2; i+1<N; ++i) { // cerr << S << '\n'; // cerr << S+C[1]+C[1]+S+C[1]+C[2]+S+C[1]+C[3]+S+C[2]+C[1] << '\n'; int tmp = press(S+C[1]+C[1]+S+C[1]+C[2]+S+C[1]+C[3]+S+C[2]+C[1]); if (tmp==i-1) { S[i-1] = C[2]; S += C[1]; } if (tmp==i) S += C[3]; if (tmp==i+1) S += C[2]; if (tmp==i+2) S += C[1]; } int tmp = press(S+C[1]); if (tmp<S.size()) { S[N-2] = C[2]; S += C[1]; } if (tmp==S.size()+1) { S += C[1]; } if (tmp==S.size()) { if (press(S+C[2])==S.size()+1) S += C[2]; else S += C[3]; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:62:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     if (tmp<S.size()) {
      |         ~~~^~~~~~~~~
combo.cpp:66:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     if (tmp==S.size()+1) {
      |         ~~~^~~~~~~~~~~~
combo.cpp:69:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |     if (tmp==S.size()) {
      |         ~~~^~~~~~~~~~
combo.cpp:70:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |         if (press(S+C[2])==S.size()+1)
      |             ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...