Submission #1202582

#TimeUsernameProblemLanguageResultExecution timeMemory
1202582avro2_718Combo (IOI18_combo)C++20
10 / 100
14 ms456 KiB
#include "combo.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define vl vector<ll>
#define pb push_back
#define ff first 
#define ss second
#define dout(x) cerr<<#x<<": "<<x<<"\n";
#define vout(x) cerr<<#x<<": "; \
for (auto &i:x){cerr<<i<<" ";} cerr<<"\n";
#define mout(x)cerr<<#x<<":\n"; \
for (auto &i:x){cerr<<i.ff<<" "<<i.ss<<"\n";}
using namespace std;
using namespace __gnu_pbds;
template<typename T> using oset = tree<T, null_type, 
less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod=1e9+7, inf=(1LL<<62), N=4e4+5;

std::string guess_sequence(int n) {
  set<char>s={'A', 'B', 'X', 'Y'};
  string str;
  int A = press("A"), B=press("B"), X=press("X"), Y=press("Y");
  if (A) {
    s.erase('A');
    str.pb('A');
  }
  if (B) {
    s.erase('B');
    str.pb('B');
  }
  if (X) {
    s.erase('X');
    str.pb('X');
  }
  if (Y) {
    s.erase('Y');
    str.pb('Y');
  }
  for (ll i=2; i<=n; i++){
    for (auto &j:s){
      str.pb(j);
      if (press(str)==i) break;
      str.pop_back();
    }
  }
  return str;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...