제출 #963458

#제출 시각아이디문제언어결과실행 시간메모리
963458The_Samurai콤보 (IOI18_combo)C++17
30 / 100
22 ms1472 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; random_device rd; mt19937_64 mt(rd()); void shuffle(string &s) { for (int i = 1; i < s.size(); i++) swap(s[rand() % (i + 1)], s[i]); } string guess_sequence(int n) { string ans = "", s = "ABXY"; shuffle(s); for (int i = 0; i < 3; i++) { ans += s[i]; if (press(ans)) break; ans.pop_back(); } if (ans.empty()) ans += s.back(); s.erase(find(s.begin(), s.end(), ans[0])); for (int ln = 2; ln <= n; ln++) { shuffle(s); for (int i = 0; i < 2; i++) { ans += s[i]; if (press(ans) == ln) break; ans.pop_back(); } if (ans.size() != ln) ans += s.back(); } return ans; }

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

combo.cpp: In function 'void shuffle(std::string&)':
combo.cpp:9:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for (int i = 1; i < s.size(); i++) swap(s[rand() % (i + 1)], s[i]);
      |                   ~~^~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |     if (ans.size() != ln) ans += s.back();
      |         ~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...