Submission #547001

#TimeUsernameProblemLanguageResultExecution timeMemory
547001beedleCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <iterator>
#include <stack>
#include <map>
#include <math.h>
#include <bitset>
#include <deque>
#include <string>
#include <tuple>
#include <queue>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
#define pi 3.141592653589793238
#define ll long long
#define ld long double
#define rep(i, a, b) for (long long i = a; i <= b; i++)
#define mod 1000000007ll
#define INF 1000000000000000000
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin (), (x).end ()
#define sz(x) (ll) (x).size ()
#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())
#define rank rnk
#define log lg
#define fast                                                                  \
    ios_base::sync_with_stdio (false);                                        \
    cin.tie (NULL);                                                           \
    cout.tie (NULL)
 
using namespace std;

// int press(string p)
// {
//     cout<<p<<endl;
//     fflush(stdout);
//     int s;
//     cin>>s;
//     return s;
// }

string guess_sequence(int n)
{
    string ans="";
    vector <char> pos={'A','B','X','Y'};

    for(auto c:pos)
    {
        string q="";
        q.pb(c);
        int x=press(q);
        if(x==1)
        {
            ans.pb(c);
            break;
        }
    }

    while(sz(ans)!=n)
    {
        for(auto c:pos)
        if(c!=ans[0])
        {
            string q=ans;
            q.pb(c);
            int x=press(q);
            if(x==sz(ans)+1)
            {
                ans.pb(c);
                break;
            }
        }
    }

    return ans;
}

// signed main()
// {
    // fast;

    // freopen("milkorder.in","r",stdin);
    // freopen("milkorder.out","w",stdout);

    // guess_sequence(5);

//     return 0;
// }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:58:15: error: 'press' was not declared in this scope
   58 |         int x=press(q);
      |               ^~~~~
combo.cpp:73:19: error: 'press' was not declared in this scope
   73 |             int x=press(q);
      |                   ^~~~~