제출 #1008490

#제출 시각아이디문제언어결과실행 시간메모리
1008490nickolasarapidis콤보 (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ string S = ""; int first = 5, last = 4; bool a; char buttons[4] = {'A', 'B', 'X', 'Y'}; vector<char> b; // size of b = 3 for(int i = 0; i < 3; i++){ if(press(S + buttons[i]) > 0){ first = i; break; } } if(first == 5){ first = 3; S += buttons[3]; } // Q = 3 at worst for(int i = 0; i < 4; i++){ if(i != first){ b.push_back(buttons[i]); } } for(int i = 1; i < N; i++){ a = false; for(int i = 0; i < 2; i++){ if(press(S + b[i]) == i + 1){ S += b[i]; a = true; break; } } if(a == false){ S += b[2]; } } // Q = 2*N + 3 at worst return S; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:17: warning: unused variable 'last' [-Wunused-variable]
    7 |  int first = 5, last = 4;
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...