제출 #792820

#제출 시각아이디문제언어결과실행 시간메모리
792820fatemetmhr콤보 (IOI18_combo)C++17
5 / 100
872 ms432 KiB
// Be name khode // #include "combo.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define all(x) x.begin(), x.end() #define pb push_back #define fi first #define se second #define mp make_pair typedef long long ll; const int maxn5 = 5e5 + 10; const int lg = 20; string s[4]; char a[4]; std::string guess_sequence(int n) { string c[4] = {"A", "B", "X", "Y"}; shuffle(c, c + 4, rng); if(press(c[0])) s[0] = s[1] = s[2] = s[3] = c[0]; else if(press(c[1])) s[0] = s[1] = s[2] = s[3] = c[1]; else if(press(c[2])) s[0] = s[1] = s[2] = s[3] = c[2]; else if(press(c[3])) s[0] = s[1] = s[2] = s[3] = c[3]; for(int i = 0; i < 4; i++) a[i] = c[i][0]; while(s[0].size() < n){ for(int i = 0; i < 4; i++) while(s[i].size() < n) s[i].pb(a[rng() % 4]); string t = s[0] + s[1] + s[2] + s[3]; int k = press(t); for(int i = 0; i < 4; i++) while(s[i].size() > k) s[i].pop_back(); } shuffle(s, s + 4, rng); for(int i = 0; i < 4; i++) if(press(s[i]) == n) return s[i]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
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 |     while(s[0].size() < n){
      |           ~~~~~~~~~~~~^~~
combo.cpp:41:31: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |             while(s[i].size() < n)
      |                   ~~~~~~~~~~~~^~~
combo.cpp:46:31: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |             while(s[i].size() > k)
      |                   ~~~~~~~~~~~~^~~
combo.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...