제출 #447543

#제출 시각아이디문제언어결과실행 시간메모리
447543MohamedAliSaidaneCombo (IOI18_combo)C++14
0 / 100
34 ms360 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; #define pb push_back #define popb pop_back #define ff first #define ss second const int MOD = 1e9 + 7; const ll INF = 1e18; string guess_sequence(int n) { char but[4] = {'A','B','X','Y'}; string p = ""; string s = ""; int fr = -1; for(int i = 0; i < 4; i ++) { string g = but[i]+p; int rep = press(g); if(rep == 1) { fr = i; s = but[i]+p; break; } } but[fr] = 'Y'; string first = but[0] + ""; string second = "" + but[1] + but[0]; string third = "" + but[1] + but[1]; string fourth = "" + but[1] + but[2]; while(s.length() < n -1) { string g = s + first + s + second + s + third + s + fourth; int tent = press(g); if(tent == s.length() +1) { s += but[0] ; } else if(tent == s.length() + 2) { s += but[1]; } else { s += but[2]; } } if(n != 1) { if(press(s+but[0]) == n) s += but[0]; else if(press(s+but[1]) == n) s += but[1]; else s += but[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:20: 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(s.length() < n -1)
      |         ~~~~~~~~~~~^~~~~~
combo.cpp:42:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |      if(tent == s.length() +1)
      |         ~~~~~^~~~~~~~~~~~~~~~
combo.cpp:46:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |      else if(tent == s.length() + 2)
      |              ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...