제출 #528646

#제출 시각아이디문제언어결과실행 시간메모리
528646rayfish콤보 (IOI18_combo)C++17
30 / 100
48 ms668 KiB
#include <climits> #include <iostream> #include <algorithm> #include <cmath> #include <deque> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_set> #include <unordered_map> #include <utility> #include <vector> #include "combo.h" using namespace std; using ll = long long; //int press(string s) { // return 0; //} string guess_sequence(int N) { string cur; char letters[] {'A', 'B', 'X', 'Y'}; // find first letter for (int t_i = 0; t_i < 3; t_i++) { if (press(cur + letters[t_i]) == 1) { cur += letters[t_i]; break; } } if (cur.length() == 0) { cur += letters[3]; } // find next letters for (int i = 1; i < N; i++) { int num_c = 0; int t_i = 0; for (; num_c < 2; t_i++) { if (cur[0] == letters[t_i]) continue; if (press(cur + letters[t_i]) == i+1) { cur += letters[t_i]; break; } else { num_c++; } } if (cur.length() == i) { if (t_i == 3) { cur += letters[3]; } else { cur += (cur[0] == letters[2] ? letters[3] : letters[2]); } } } return cur; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |         if (cur.length() == i) {
      |             ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...