Submission #109489

#TimeUsernameProblemLanguageResultExecution timeMemory
109489kenken714Combo (IOI18_combo)C++14
100 / 100
66 ms560 KiB
#include <iostream> #include <string> #include <utility> #include <algorithm> #include <map> #include <set> #include <vector> #include <cmath> #include <cstdlib> #include <queue> #include <stack> #include <iomanip> using namespace std; #define REP(i, n) for(ll i = 0;i < n;i++) #define REPR(i, n) for(ll i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(ll i = 1;i <= n;i++) #define ll long long #define INF (ll)1 << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(),n.end() #define MOD 1000000007 #define P pair<ll, ll> #include "combo.h" map<ll, char>mp; string guess_sequence(int N) { mp[0] = 'A'; mp[1] = 'B'; mp[2] = 'X'; mp[3] = 'Y'; string ans; ll p; vector<ll>list; //先頭文字決めるよ(*'ω'*) if (press("AB") >= 1) { if (press("A") == 1)p = 0; else p = 1; } else { if (press("X") == 1)p = 2; else p = 3; } ans.push_back(mp[p]); REP(i, 4) { if (i != p)list.push_back(i); } //最後の文字以外を決めるよ(*'ω'*)(*'ω'*) FOR(i, 1, N - 1) { string now; REP(j, 3) { now += ans; now.push_back(mp[list[0]]); now.push_back(mp[list[j]]); } now += ans; now.push_back(mp[list[1]]); ll res = press(now); if (res == i + 2)ans.push_back(mp[list[0]]); else if (res == i + 1)ans.push_back(mp[list[1]]); else ans.push_back(mp[list[2]]); } //最後の文字決めるよ(*'ω'*)(*'ω'*)(*'ω'*) if (N != 1) { string aa = ans, bb = ans; ll a, b; aa.push_back(mp[list[0]]); bb.push_back(mp[list[1]]); aa += ans; bb += ans; aa.push_back(mp[list[1]]); bb.push_back(mp[list[2]]); a = press(aa); b = press(bb); if (a == N and b == N - 1)ans.push_back(mp[list[0]]); else if (a == N and b == N)ans.push_back(mp[list[1]]); else ans.push_back(mp[list[2]]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...