Submission #1202578

#TimeUsernameProblemLanguageResultExecution timeMemory
1202578avro2_718Combo (IOI18_combo)C++20
5 / 100
0 ms408 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 (auto &i:s){
    str.pb(i);
    if (press(str)==2) break;
    str.pop_back();
  }
  for (auto &i:s){
    str.pb(i);
    if (press(str)==3) break;
    str.pop_back();
  }
  return str;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...