Submission #699208

#TimeUsernameProblemLanguageResultExecution timeMemory
699208BaytoroCombo (IOI18_combo)C++17
100 / 100
39 ms592 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ios ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define endl '\n' //#define int long long //#define ll long long void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } const long long INF=1e18,mod=1e9+7; string guess_sequence(int n) { string ans,a="A",b="B",c="X",d="Y"; int s=press(a+b); if(s>=1){ if(press(b)==1) swap(a,b); } else{ if(press(c)) swap(a,c); else swap(a,d); } ans=a; for(int i=1;i<n-1;i++){ int k=press(ans+b+ans+c+b+ans+c+c+ans+c+d); if(k==(int)ans.size()+1) ans=ans+b; else if(k==(int)ans.size()+2) ans=ans+c; else ans=ans+d; } if(n>1){ s=press(ans+b+ans+c); if(s==n){ if(press(ans+b)==n) ans=ans+b; else ans=ans+c; } else ans=ans+d; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'void fopn(std::string)':
combo.cpp:14:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp:15:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...