Submission #646082

#TimeUsernameProblemLanguageResultExecution timeMemory
646082sandry24Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
     
int press(std::string p);
vector<char> chars = {'A', 'B', 'X', 'Y'};
 
string guess_sequence(int n){
    string temp = "";
    while(temp.size() != n){
        if(temp.size() == 0){
            int ans = 3;
            for(int i = 0; i < 3; i++)
                if(press(temp + chars[i]) == temp.size()+1)
                    ans = i;
            temp += chars[ans];
            chars.erase(find(chars.begin(), chars.end(), temp[0]));
        } else {
            int ans = 2;
            for(int i = 0; i < 2; i++)
                if(press(temp + chars[i]) == temp.size()+1)
                    ans = i;
            temp += chars[ans];
        }
    }
    return temp;
}

void solve(){

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while(temp.size() != n){
      |           ~~~~~~~~~~~~^~~~
combo.cpp:21:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |                 if(press(temp + chars[i]) == temp.size()+1)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:28:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                 if(press(temp + chars[i]) == temp.size()+1)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccLRU6Yz.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXx37Dy.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status