# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941207 | FIFI_cpp | Combo (IOI18_combo) | C++17 | 1 ms | 596 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include "combo.h"
using ll = long long;
#define pb push_back
#define all(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// xcode cant include bits/stdc++.h
using namespace std;
//ifstream fin ("fenceplan.in");
//ofstream fout ("fenceplan.out");
string guess_sequence(int N) {
string res = "";
string chars = "ABXY";
if (press("AB") >= 1)
{
if (press("A") == 1)
{
res += "A";
chars.erase(chars.begin());
}
else
{
chars.erase(chars.begin() + 1);
res += "B";
}
}
else
{
if (press("x") == 1)
{
res += "X";
chars.erase(chars.begin() + 2);
}
else
{
res += "Y";
chars.erase(chars.begin() + 3);
}
}
for (int i = 1;i < N - 1;i++)
{
string ask = "";
char askc = chars[0];
for (int k = 0;k < 3;k++)
{
ask += res + askc + chars[k];
}
ask += res + chars[1];
int x = press(ask);
if (x == res.size() + 2)
res += chars[0];
else if (x == res.size() + 1)
res += chars[1];
else
res += chars[2];
}
if (N >= 2)
{
if (press(res + chars[0]) == res.size() + 1)
{
res += chars[0];
}
else if (press(res + chars[1]) == res.size() + 1)
res += chars[1];
else
res += chars[2];
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |