제출 #597297

#제출 시각아이디문제언어결과실행 시간메모리
597297Abdulmohsen1284콤보 (IOI18_combo)C++14
100 / 100
40 ms520 KiB
#include"bits/stdc++.h" using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<class x> using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void usaco(){freopen("cruise.out","w",stdout);freopen("cruise.in","r",stdin);} long long a[2000005],c[2000005]; #include "combo.h" std::string guess_sequence(int N) { int n=N; string ans; string fr="AB",sc="XY"; set <char> h; h.insert('A'); h.insert('X'); h.insert('B'); h.insert('Y'); int coin = press(fr); if(coin>0) { fr="A"; coin = press(fr); if(coin>0) { h.erase('A'); ans+="A"; } else { h.erase('B'); ans+="B"; } } else { sc="X"; coin = press(sc); if(coin>0) { h.erase('X'); ans+="X"; } else { h.erase('Y'); ans+="Y"; } } if(n==1) return ans; vector <char> v; for(auto i : h) v.push_back(i); long long bef=1; for(int i=1;i<N-1;i++) { bef=i; string cur = ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2]; int bruh = press(cur); if(bruh==bef) { ans+=v[2]; } else if(bruh==bef+1) { ans+=v[0]; } else ans+=v[1]; } fr=ans+v[0]+ans+v[1]; int bruh = press(fr); if(bruh==n) { fr=ans+v[0]; bruh = press(fr); if(bruh==n) ans+=v[0]; else ans+=v[1]; } else ans+=v[2]; return ans; } /* int main() { ios_base::sync_with_stdio(0); cin.tie(0); }*/

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'void usaco()':
combo.cpp:9:21: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | void usaco(){freopen("cruise.out","w",stdout);freopen("cruise.in","r",stdin);}
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp:9:54: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | void usaco(){freopen("cruise.out","w",stdout);freopen("cruise.in","r",stdin);}
      |                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...