This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "combo.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string guess_sequence(int n) {
string ans;
int x = 0;
if(press("AB"))
if(press("A")) ans = "A";
else { ans = "B"; x = 1; }
else
if(press("X")) { ans = "X"; x = 2; }
else { ans = "Y"; x = 3; }
char ask[4] = {'A', 'B', 'X', 'Y'};
swap(ask[3], ask[x]);
for(int i = 1; i < n - 1; i++) {
string query = ans + ask[0] + ans + ask[1] + ask[0] + ans + ask[1] + ask[1] + ans + ask[1] + ask[2];
int c = press(query);
if(c == i) ans += ask[2];
else if(c == i + 1) ans += ask[0];
else ans += ask[1];
}
if(press(ans + ask[0] + ans + ask[1]) == n)
if(press(ans + ask[0]) == n) ans += ask[0];
else ans += ask[1];
else ans += ask[2];
return ans;
}
/*
*/
Compilation message (stderr)
combo.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization ("unroll-loops")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |