제출 #1014748

#제출 시각아이디문제언어결과실행 시간메모리
1014748MrPavlito콤보 (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define sc second #define endl "\n" #define pii pair<int,int> using namespace std; std::string guess_sequence(int N) { string rez = ""; vector<string> slova; if(press("AB") > 0) { if(press("A") == 1) { rez = "A"; slova.pb("B"); slova.pb("X"); slova.pb("Y"); } else { rez = "B"; slova.pb("A"); slova.pb("X"); slova.pb("Y"); } } else { if(press("X") == 1) { rez = "X"; slova.pb("B"); slova.pb("A"); slova.pb("Y"); } else { rez = "Y"; slova.pb("B"); slova.pb("X"); slova.pb("A"); } } for(int i=0; i<N-2; i++) { string guess = rez+slova[0]+slova[0]+rez+slova[0]+slova[1]+rez+slova[0]+slova[2]+rez+slova[1]; int p = press(guess); if(p == rez.size()+2) { rez+=slova[0]; } else if(p == rez.size()) { rez+=slova[2]; } else { rez+=slova[1]; } } if(press(rez+slova[0]) == N) { return rez+slova[0]; } else if(press(rez+slova[1]) == N) { return rez+slova[1]; } else return rez+slova[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:54:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         if(p == rez.size()+2)
      |            ~~^~~~~~~~~~~~~~~
combo.cpp:58:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |         else if(p == rez.size())
      |                 ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...