Submission #580011

#TimeUsernameProblemLanguageResultExecution timeMemory
580011xynexCombo (IOI18_combo)C++17
5 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define ll long long #define dl double long #define ull unsigned long long #define pr pair #define vt vector #define ff first #define ss second #define mp make_pair #define sz(a) (int)a.size() #define pb push_back #define pf push_front #define popB pop_back #define popF pop_front #define bit_count __builtin_popcount #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sp(x) fixed << setprecision(x) template<typename T> T lcm(T a, T b) { return a * (b / __gcd(a, b)); } template<class A> void read(vt<A>& v); template<class A, size_t S> void read(array<A, S>& a); template<class T> void read(T& x) { cin >> x; } void read(double& d) { string t; read(t); d = stod(t); } void read(long double& d) { string t; read(t); d = stold(t); } template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); } template<class A> void read(vt<A>& x) { for (auto& a : x) read(a); } template<class A, size_t S> void read(array<A, S>& x) { for (auto& a : x) read(a); } string to_string(char c) { return string(1, c); } string to_string(bool b) { return b ? "true" : "false"; } string to_string(const char* s) { return string(s); } string to_string(string s) { return s; } string to_string(vt<bool> v) { string res; for (int i = 0; i < sz(v); ++i) res += char('0' + v[i]); return res; } template<size_t S> string to_string(bitset<S> b) { string res; for (int i = 0; i < S; ++i) res += char('0' + b[i]); return res; } template<class T> string to_string(T v) { bool f = 1; string res; for (auto x : v) { if (!f) res += ' '; f = 0; res += to_string(x); } return res; } template<class A> void write(A x) { cout << to_string(x); } template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); } void print() { write("\n"); } template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); } int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; /* ll vs int*/ /* namespace { constexpr int MAX_N = 2000; constexpr int MAX_NUM_MOVES = 8000; int N; std::string S; int num_moves; void wrong_answer(const char *MSG) { printf("Wrong Answer: %s\n", MSG); exit(0); } } // namespace int press(std::string p) { if (++num_moves > MAX_NUM_MOVES) { wrong_answer("too many moves"); } int len = p.length(); //print(p); if (len > 4 * N) { //print("BAD"); wrong_answer("invalid press"); } for (int i = 0; i < len; ++i) { if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') { //print(p); wrong_answer("invalid press"); } } int coins = 0; for (int i = 0, j = 0; i < len; ++i) { if (j < N && S[j] == p[i]) { ++j; } else if (S[0] == p[i]) { j = 1; } else { j = 0; } coins = std::max(coins, j); } return coins; }*/ string guess_sequence(int N) { string ans = ""; string need = ""; if(press("AB")) { if(press("A")) { ans += "A"; need = "BXY"; } else { ans += "B"; need = "AXY"; } } else { if(press("X")) { ans += "X"; need = "ABY"; } else { ans += "Y"; need = "ABX"; } } for(int i = 2; i < N; ++i) { //print(i, ans); int cur = press(ans + need[0] + need[0] + ans + need[0] + need[1] + ans + need[0] + need[2] + ans + need[1]) - sz(ans); // print(cur); if(cur == 0) ans += need[2]; else if(cur == 1) ans += need[1]; else ans += need[0]; } int cur = press(ans + need[0] + ans + need[1]) - sz(ans); if(cur == 1) { if(press(ans + need[0]) == N) ans += need[0]; else ans += need[1]; } else { ans += need[2]; } return ans; } /*int main() { char buffer[MAX_N + 1]; if (scanf("%s", buffer) != 1) { fprintf(stderr, "Error while reading input\n"); exit(1); } S = buffer; N = S.length(); num_moves = 0; std::string answer = guess_sequence(N); if (answer != S) { wrong_answer("wrong guess"); exit(0); } printf("Accepted: %d\n", num_moves); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...