Submission #416167

#TimeUsernameProblemLanguageResultExecution timeMemory
4161672fat2codeCombo (IOI18_combo)C++17
100 / 100
35 ms612 KiB
#include "combo.h" #include <bits/stdc++.h> #define ll long long #define ld long double #define all(a) (a).begin(), (a).end() #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define sz() size() #define fr first #define sc second #define pi pair<int,int> #define pii pair<pair<int,int>,int> #define mp make_pair //#define int long long #define rc(s) return cout<<s,0 #define rcc(s) cout<<s,exit(0) using namespace std; const int mod=1e9+7; const int modp=1999999973; const int modulo=998244353; vector<char>ch; vector<char>ch2; string guess_sequence(int N) { ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); srand(chrono::steady_clock::now().time_since_epoch().count()); string tz; ch.push_back('Y'); ch.push_back('A'); ch.push_back('B'); ch.push_back('X'); if(press("AB")){ if(press("A")) tz+='A'; else tz+='B'; } else{ if(press("X")) tz+='X'; else tz+='Y'; } for(int i=0;i<ch.size();i++){ if(ch[i]!=tz.back()) ch2.push_back(ch[i]); } for(int i=1;i<(N-1);i++){ // random_shuffle(all(ch2)); string ask=(tz+ch2[0]+ch2[0]+tz+ch2[0]+ch2[1]+tz+ch2[0]+ch2[2]+tz+ch2[1]); int g=press(ask); if(g==(i+2)) tz.push_back(ch2[0]); else if(g==(i+1)) tz.push_back(ch2[1]); else tz.push_back(ch2[2]); } if(N>=2){ // random_shuffle(all(ch2)); for(int i=0;i<=1;i++){ tz+=ch2[i]; if(press(tz)==N) goto next1; tz.pop_back(); } tz+=ch2[2]; next1:; } return tz; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int i=0;i<ch.size();i++){
      |                 ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...