제출 #376047

#제출 시각아이디문제언어결과실행 시간메모리
376047Gajowy콤보 (IOI18_combo)C++14
100 / 100
48 ms560 KiB
/* Antoni Dlugosz VLO Krakow "You know google - they ask you interview questions, well, the kind of question i face on the job is: "is this bad, is this too much voodoo for our purposes for our mission statement?". Our mission is to be a modern Commodore64, is this too much voodoo that, this is the op-, this, there is, this is voodoo, the question is "is this too much?" and that's, this is the hardest question you could ever face in programming. This right here is the hardest question, right here, right here is the hardest question in programming, "is this too much voodoo for the next ten centuries?", as f-, for god's officlal temple, Holy, Holy C is the hardest question in programming, right here, okay, there it is, the hardest question in programming." ~ the late Terry A. Davis */ //fast stuff //#pragma GCC optimize("Ofast") //#pragma GCC optimization ("O3") //#pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "combo.h" using namespace __gnu_pbds; using namespace std; #define mp make_pair #define eb emplace_back #define pb push_back #define e1 first #define e2 second #define vt vector #define size(x) (int32_t)x.size() #define all(r) begin(r),end(r) #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define time chrono::high_resolution_clock().now().time_since_epoch().count() #define satori int32_t TCS; cin>>TCS; while(TCS--) #ifndef DEBUGMODE #define DEBUGMODE false #endif #define debug if(DEBUGMODE) typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef unsigned int uint; template<typename T> using ordset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; string guess_sequence(int n){ int qans; qans=press("AB"); char beg='0'; if(qans==0){ qans=press("X"); if(qans==0) beg='Y'; else beg='X'; } else{ qans=press("A"); if(qans==0) beg='B'; else beg='A'; } string res; res.pb(beg); vt<char> chars; if(beg!='A') chars.pb('A'); if(beg!='B') chars.pb('B'); if(beg!='X') chars.pb('X'); if(beg!='Y') chars.pb('Y'); for(int i=1;i<n-1;i++){ string s=res+chars[0]+res+chars[1]+chars[0]+res+chars[1]+chars[1]+res+chars[1]+chars[2]; qans=press(s); if(qans==size(res)) res.pb(chars[2]); else if(qans==size(res)+1) res.pb(chars[0]); else res.pb(chars[1]); } if(n!=1){ string s=res+chars[0]+res+chars[1]; qans=press(s); if(qans==size(res)){ s=res+chars[2]; qans=press(s); if(qans==size(res)) res.pb(chars[3]); else res.pb(chars[2]); } else{ s=res+chars[0]; qans=press(s); if(qans==size(res)) res.pb(chars[1]); else res.pb(chars[0]); } } return res; } /* stuff declared locally is not always equal to zero! pointers on 64-bit environments take up 64 bits, not 32 vectors take up a lot of space bitsets don't take up a lot of space going out of bounds is bad too much voodoo is bad too much abstraction doesn't really impact performance in c++ abstraction is good not returning in a non void function is bad infinite loops are bad overflow is bad declaring stuff locally is good cc_hash_table has faster queries, but considerably slower updates than gp_hash_table overanalyzing stuff is good assume nothing works correctly don't do dumb stuff speedrun writing slow solutions and generators at the start of the contest remember to use pragmas :) */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...