Submission #486436

#TimeUsernameProblemLanguageResultExecution timeMemory
486436ssense콤보 (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> #include "combo.h" #define startt ios_base::sync_with_stdio(false);cin.tie(0); typedef long long ll; using namespace std; #define vint vector<int> #define all(v) v.begin(), v.end() #define MOD 1000000007 #define MOD2 998244353 #define MX 1000000000 #define MXL 1000000000000000000 #define PI (ld)2*acos(0.0) #define nax 200005 #define pb push_back #define sc second #define fr first //#define int long long #define endl '\n' #define ld long double #define NO cout << "NO" << endl #define YES cout << "YES" << endl string guess_sequence(int n) { string s; vector<char> a(4); a[0] = 'A'; a[1] = 'B'; a[2] = 'X'; a[3] = 'Y'; s.pb(a[0]); s.pb(a[1]); int exclude = 0; int k = press(s); if(k >= 1) { s.pop_back(); k = press(s); if(k == 0) { s.pop_back(); s.pb(a[1]); exclude = 1; } } else { s.pop_back();s.pop_back(); s.pb(a[2]); k = press(s); exclude = 2; if(k == 0) { s.pop_back(); s.pb(a[3]); exclude = 3; } } int one = 0, two = 0, three = 0; if(exclude == one) { one++; } two = one+1; if(two == exclude) { two++; } three = two+1; if(three == exclude) { three++; } for(int i = 0; i < n-2; i++) { string now = s+a[one]+a[one]+s+a[one]+a[two]+s+a[one]+a[three]+s+a[two]; k = press(now); if(k == s.size()+2) { s.pb(a[one]); continue; } if(k == s.size()+1) { s.pb(a[two]); continue; } if(k == s.size()) { s.pb(a[three]); continue; } } s.pb(a[0]); s.pb(a[1]); k = press(s); if(k >= s.size()-1) { s.pop_back(); k = press(s); if(k == s.size()-1) { s.pop_back(); s.pb(a[1]); } } else { s.pop_back();s.pop_back(); s.pb(a[2]); k = press(s); if(k == s.size()-1) { s.pop_back(); s.pb(a[3]); } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:74:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |   if(k == s.size()+2)
      |      ~~^~~~~~~~~~~~~
combo.cpp:79:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |   if(k == s.size()+1)
      |      ~~^~~~~~~~~~~~~
combo.cpp:84:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |   if(k == s.size())
      |      ~~^~~~~~~~~~~
combo.cpp:92:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   92 |  if(k >= s.size()-1)
      |     ~~^~~~~~~~~~~~~
combo.cpp:96:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |   if(k == s.size()-1)
      |      ~~^~~~~~~~~~~~~
combo.cpp:107:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  107 |   if(k == s.size()-1)
      |      ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...