Submission #1069133

#TimeUsernameProblemLanguageResultExecution timeMemory
1069133hasan2006Combo (IOI18_combo)C++17
100 / 100
23 ms2092 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" //const int N = 5e5 + 9 , mod = 1e9 + 7; //ll a[N] , b[N] , dp[N] , c[N] , d[N]; //int press(string a){} std::string guess_sequence(int n){ vector<string>v = {"A" , "B" , "X", "Y"}; if(n == 1){ for(auto to : v) if(to == "Y" || press(to)) return to; } string b; if(press("AB")){ b = (press("A") ? "A" : "B"); }else{ b = (press("X") ? "X" : "Y"); } vector<string>vc; for(auto to : v) if(to != b) vc.pb(to); for(int i = 1; i < n - 1; i++){ string a = b + vc[0] + vc[0] + b + vc[0] + vc[1] + b + vc[0] + vc[2] + b + vc[1]; int k = press(a); if(k == i + 2) b += vc[0]; else if(k == i + 1) b += vc[1]; else b += vc[2]; } if(press(b + vc[0] + b + vc[1]) == n) b += ((press(b + vc[0]) == n) ? vc[0] : vc[1]); else b += vc[2]; return b; } /* int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif guess_sequence(2); }*/ // Author : حسن
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...