제출 #1021505

#제출 시각아이디문제언어결과실행 시간메모리
1021505khome콤보 (IOI18_combo)C++17
30 / 100
37 ms592 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { vector<string> a; a={"A", "B", "X", "Y"}; string res, cur, per = ""; int n; for (string i : a){ if (press(i) == 1){ per = i; res+=i; break; } } while (res.size()!=N){ n = res.size(); for (string i:a){ if (i != per && i != res[-1]+"0"){ // cout << "current res = " << res << ' '; cur = res; while (res.size()!=N){ res+=i; } // cout << " after = " << res << ' '; int p = press(res); if (p > n){ cur=""; for (int j = 0; j < p; j++){ cur += res[j]; } // cout << "changed = " << cur << ' '; } res = cur; // cout << "\n"; } if (res.size()==N) break; } } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (res.size()!=N){
      |            ~~~~~~~~~~^~~
combo.cpp:24:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |           while (res.size()!=N){
      |                  ~~~~~~~~~~^~~
combo.cpp:39:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |         if (res.size()==N) break;
      |             ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...