Submission #196875

#TimeUsernameProblemLanguageResultExecution timeMemory
196875AaronNaidu콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

ifstream fin(".in");
ofstream fout(".out");
int coins;
string combo;
bool done;
char poss[4]; 

//int press(string p) {
//    
//}

string guess_sequence(int N) {
    combo = "";
    //poss = {'A', 'B', 'X', 'Y'};
    coins = press("AB");
    if(coins) {
        coins = press("A");
        if(coins) {
            combo = "A";
        }
        else {
            combo = "B";
        }
    }
    else {
        coins = press("X");
        if(coins) {
            combo  = "X";
        }
        else {
            combo = "Y";
        }
    }
    for (int i = 1; i < N; i++)
    {
        done = false;
        if(combo[0] != 'A') {
            coins = press(combo+"A");
            if(coins > combo.length()) {
                combo = combo + "A";
                done = true;
            }
        }
        if(combo[0] != 'B') {
            coins = press(combo+"B");
            if(coins > combo.length()) {
                combo = combo + "B";
                done = true;
            }
        }
        if(combo[0] != 'X') {
            if(combo[0] == 'Y') {
                if(not done) {
                    combo = combo + "X";
                    done = true;
                } 
            }
            else {
                coins = press(combo+"X");
                if(coins > combo.length()) {
                    combo = combo + "X";
                    done = true;
                }
            }
            
        }
        if(not done) {
           combo = combo + "Y"; 
        }
    }
    return combo;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:13: error: 'press' was not declared in this scope
   18 |     coins = press("AB");
      |             ^~~~~
combo.cpp:42:22: 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(coins > combo.length()) {
      |                ~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             if(coins > combo.length()) {
      |                ~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:63:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |                 if(coins > combo.length()) {
      |                    ~~~~~~^~~~~~~~~~~~~~~~