Submission #261463

#TimeUsernameProblemLanguageResultExecution timeMemory
261463Valera_GrinenkoCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#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 st = press("XY"); if(st) if(press("X")) ans = "X"; else ans = "Y"; else if(press("A")) ans = "A"; else ans = "B"; vector<char> ask(4); ask[0] = 'A'; ask[1] = 'B'; ask[2] = 'X'; ask[3] = 'Y'; ask.erase(find(all(ask), ans[0])); for(int i = 1; i < n; 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 == ans.size()) ans += ans[2]; else if(c == ans.size() + 1) ans += ask[0]; else ans += ask[1]; } return ans; } /* */

Compilation message (stderr)

combo.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     if(c == ans.size()) ans += ans[2];
      |        ~~^~~~~~~~~~~~~
combo.cpp:46:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     else if(c == ans.size() + 1) ans += ask[0];
      |             ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...