제출 #212229

#제출 시각아이디문제언어결과실행 시간메모리
212229MarcoMeijer콤보 (IOI18_combo)C++14
100 / 100
40 ms604 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; //macros typedef long long ll; typedef pair<int, int> ii; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; #define REP(a,b,c) for(int a=int(b); a<int(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--) #define INF 1e9 #define pb push_back #define fi first #define se second mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); string guess_sequence(int N) { string knows; if(press("AB")) { if(press("A")) knows="A"; else knows="B"; } else { if(press("X")) knows="X"; else knows="Y"; } string t[3]; int m=0; if(knows != "A") t[m++]="A"; if(knows != "B") t[m++]="B"; if(knows != "X") t[m++]="X"; if(knows != "Y") t[m++]="Y"; while(knows.size() < N-1) { int res=press(knows+t[1]+knows+t[2]+t[0]+knows+t[2]+t[1]+knows+t[2]+t[2])-knows.size(); knows += t[res]; } if(knows.size() == N-1) { if(press(knows+t[0])!=knows.size()) knows += t[0]; else if(press(knows+t[1])!=knows.size()) knows += t[1]; else knows += t[2]; } return knows; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |   while(knows.size() < N-1) {
      |         ~~~~~~~~~~~~~^~~~~
combo.cpp:42:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |   if(knows.size() == N-1) {
      |      ~~~~~~~~~~~~~^~~~~~
combo.cpp:43:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |          if(press(knows+t[0])!=knows.size()) knows += t[0];
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:44:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     else if(press(knows+t[1])!=knows.size()) knows += t[1];
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...