Submission #961163

# Submission time Handle Problem Language Result Execution time Memory
961163 2024-04-11T15:27:26 Z marinaluca Combo (IOI18_combo) C++17
Compilation error
0 ms 0 KB
#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 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

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:51: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]
   51 |     if (press (v + buton[0] + v + buton[1]) > v.size()){
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:52: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]
   52 |         if (press (v + buton[0]) > v.size()){
      |             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/cc5urMUx.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status