Submission #1104030

#TimeUsernameProblemLanguageResultExecution timeMemory
1104030asdfghjkCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define F first #define ld long double #define S second using namespace std; const ll N = 5e3 + 5; const ll NN = 4e5 + 5; const ll INF = 1e18; const ll inf = 1e9; const ll MOD = 1e9 + 7; int press(std::string p); string guess_sequence(int n){ string a = "qwertythjyh"; string s = ""; if(press("ABX")==0){ s = "Y"; a[1] = 'A'; a[2] = 'B'; a[3] = 'X'; } else if(press("ABY") == 0){ s = "X"; a[1] = 'A'; a[2] = 'B'; a[3] = 'Y'; } else if(press("AXY") == 0){ s = "B"; a[1] = 'A'; a[2] = 'Y'; a[3] = 'X'; } else{ s = "A"; a[1] = 'Y'; a[2] = 'B'; a[3] = 'X'; } for(int i = 2;i <= n;i++){ string d = s; d += a[1]; d += a[2]; int z = press(d); d = s; d += a[2]; d += a[3]; int x= press(d); if(z == s.size()){ s += a[3]; } else if(x == size()){ s += a[1]; } else s += a[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:51:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         if(z == s.size()){
      |            ~~^~~~~~~~~~~
combo.cpp:54:22: error: 'size' was not declared in this scope; did you mean 'dysize'?
   54 |         else if(x == size()){
      |                      ^~~~
      |                      dysize