Submission #1313695

#TimeUsernameProblemLanguageResultExecution timeMemory
1313695sitingfakeCombo (IOI18_combo)C++20
30 / 100
10 ms476 KiB
#include<bits/stdc++.h> using namespace std; #include "combo.h" // define //bool M1; //#define execute cerr << " Time: " << fixed << setprecision(6) << (1.0 * clock() / CLOCKS_PER_SEC) << "s\n"; //#define memory cerr << abs(&M2 - &M1)/1024.0/1024 << " MB" << "\n" #define ll long long #define ii pair <int , int> #define iii pair <int , ii> #define se second #define fi first #define all(v) (v).begin() , (v).end() #define Unique(v) sort(all(v)) , v.resize(unique(all(v)) - v.begin()) #define bit(x,i) (((x) >> (i)) & 1LL) #define flip(x,i) ((x) ^ (1LL << (i))) #define ms(d,x) memset(d , x , sizeof(d)) #define exist __exist #define ends __ends #define visit visited #define left __left #define right __right #define prev __prev #define next __next #define sitingfake 1 #define orz 1 //constant const long long mod = 1e9 + 7; const long long linf = 4557430888798830399LL; const long long nlinf = -4485090715960753727LL; const int inf = 1061109567; const int ninf = -1044266559; const int dx[] = {0 , -1 , 0 , 1}; const int dy[] = {-1 , 0 , 1 , 0}; template<typename T> bool maximize(T &a, const T &b) { if(a < b) {a = b; return 1;} return 0; } template<typename T> bool minimize(T &a, const T &b) { if(a > b) {a = b; return 1;} return 0; } void Plus(ll & a ,ll b) { b %= mod; a += b; if(a < 0) a += mod; a %= mod; return; } void Mul(ll & a, ll b) { (a *= (b % mod)) %= mod; return; } //code //const string base = "ABXYY"; // //int press(string p) //{ // int ans = 0; // for(int i = 0; i < p.size(); i++) // { // int it = 0; // while(it < base.size() && p[i + it] == base[it]) ++it; // ans = max(ans , it); // } // // return ans; //} string c[] = {"A" , "B" , "X" , "Y"}; string guess_sequence(int N) { string s = ""; int tmp = press(c[0] + c[1]); if(tmp == 0) { tmp = press(c[2]); if(tmp) s = s + c[2]; else s = s + c[3]; } else { tmp = press(c[1]); if(tmp)s = s + c[1]; else s = s + c[0]; } vector <string> p; for(int i = 0; i < 4; i++) { if(c[i] != s) p.push_back(c[i]); } for(int i = 1; i < N; i++) { random_shuffle(all(p)); int d = press(s + p[0] + s + p[1]); if(d > s.size()) { d = press(s + p[0]); //cout << i << " " << p[0] << " " << p[1] << " " << d << endl; if(d > s.size()) s = s + p[0]; else s = s + p[1]; } else s = s + p[2]; } return s; } // //void solve(void) //{ // cout << guess_sequence(5); //} ///** //**/ //bool M2; //signed main() //{ // ios_base::sync_with_stdio(0); // cin.tie(0); // cout.tie(0); // // #define task "" // // if(fopen(task".inp","r")) // { // freopen(task".inp","r",stdin); // freopen(task".out","w",stdout); // } // // int tc = 1; // cin >> tc; // while(tc--) solve(); // // execute; // memory; //}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:109:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
  109 |         random_shuffle(all(p));
      |         ~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from combo.cpp:1:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...