Submission #961170

#TimeUsernameProblemLanguageResultExecution timeMemory
961170marinalucaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> /**#pragma GCC optimize ("O4") #pragma GCC optimize ("fast-math") #pragma GCC optimize ("unroll-loops") **/ using namespace std; #define int long long #define ll long long #define all(x) begin(x), end(x) #define XX first #define YY second /** #define cin fin #define cout fout ifstream cin (""); ofstream cout (""); **/ deque <char> buton = {'A', 'B', 'X', 'Y'}; int press (string s); int N; string ans; int cnt = 0; //int press (string c){s //cnt ++; //int maxi = 0; //for (int i = 0; i < c.size(); ++ i){ //int ct = 0; //for (int j = i; j < c.size() && (j - i) < ans.size(); ++ j){ // if (c[j] == c[j - i]{ //ct ++; // maxi = max (maxi, ct); // } //else // break; // } //} //return maxi; //} string guess_sequence (int N){ string v; if (press("AB") > 0){ if (press("A") > 0){ v = "A"; buton.erase(buton.begin()); } else{ v = "B"; buton.erase(buton.begin() + 1); } } else{ if (press("X") > 0){ v = "X"; buton.erase(buton.begin() + 2); } else{ v = "Y"; buton.erase(buton.begin() + 3); } } if (N == 1){ return v; } for (int i = 2; i <= N - 1; ++ i){ int sum = press (v + buton[1] + v + buton[2] + buton[0] + v + buton[2] + buton[1] + v + buton[2] + buton[2]); v += buton[sum - v.size()]; } if (press (v + buton[0] + v + buton[1]) > v.size()){ if (press (v + buton[0]) > v.size()){ v += buton[0]; } else{ v += buton[1]; } } else{ v += buton[2]; } return v; } /**signed main(void){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0 ^ 0; }**/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:70:45: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |     if (press (v + buton[0] + v + buton[1]) > v.size()){
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:71:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |         if (press (v + buton[0]) > v.size()){
      |             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/cc0XZAWS.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status