Submission #552299

#TimeUsernameProblemLanguageResultExecution timeMemory
552299lethinh05Combo (IOI18_combo)C++11
10 / 100
59 ms444 KiB
#include<bits/stdc++.h>
#define maxn 10005
#define oo 1000000007
#define ff first
#define ss second
#define sci(x) scanf("%d", &x)
#define scii(x, y) scanf("%d %d", &x, &y)
#define fto(i, a, b) for(int i = a; i <= b; ++i)
#define fdto(i, a, b) for(int i = a; i >= b; --i)
#define pri(x) printf("%d ", x);
#define pril(x) printf("%d\n", x);
#define sz(a) (int)a.size()
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define pb push_back
#define ll long long
#define db double
#define mp make_pair
#define fast cin.sync_with_stdio(0); cin.tie(0)

using namespace std;

int press(string p);

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

string guess_sequence(int n) {
  string p = "";
  vector<char> e;
  e.pb('A');
  e.pb('B');
  e.pb('X');
  e.pb('Y');
  int i = 0;
  char check;
  while(1){
    string s = "";
    s += e[i];
    if (press(s) == 1){
        p += e[i];
        check = e[i];
        break;
    }
    ++i;
  }

  int coins = 1;
  while(1){
    for (int x = 0; x <= sz(e); ++x){
        if (check == e[x]) continue;
        if (press(p+e[x]) > coins){
            ++coins;
            p += e[x];
            break;
        }
    }
    if (coins == n) return p;
  }
  return p;
}

//int main(){
//    int n;
//    cin >> n;
//    cout << guess_sequence(n) << endl;
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...