Submission #668601

#TimeUsernameProblemLanguageResultExecution timeMemory
668601aebovAbracadabra (CEOI22_abracadabra)C++17
10 / 100
1316 ms8816 KiB
#include<iostream> #include<algorithm> #include<vector> #include<map> #include<cstring> #include<fstream> #include<unordered_map> #include<set> #include<queue> #define ln (e-s+1) #define lc (id<<1) #define rc ((id<<1)+1) #define md ((e+s)>>1) #define dm (((e+s)>>1)+1) #define ll long long #define pb push_back #define pii pair<int,int> #define pll pair<ll , ll> #define F first #define S second //#define cin fin using namespace std; const int N = 1002; int n, q, t, x, tmp, lst = 0; vector<int> state[N]; void doj(int lev){ if(lev > n) return; int p1 = 0, p2 = (n-1) / 2 + 1, p3 = ((n-1)>>1) + 1; while(p1 < p3 || p2 < n){ if(p1 < p3 && p2 < n){ if(state[lev-1][p1] < state[lev-1][p2]) state[lev].pb(state[lev-1][p1]), p1 ++; else state[lev].pb(state[lev-1][p2]), p2 ++; } else if(p1 < p3){ state[lev].pb(state[lev-1][p1]), p1 ++; } else state[lev].pb(state[lev-1][p2]), p2 ++; } if(state[lev] != state[lev-1])doj(lev + 1), lst ++; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> q; if( n > 1000)exit(0); for(int i = 0; i < n; i ++) cin >> tmp, state[0].pb(tmp); doj(1); /* for(int i = 0; i < 4 ; i ++){ cout << endl; for(auto x : state[i])cout << x << " "; }*/ while(q --){ cin >> t >> x; t = min(t, lst); cout << state[t][x-1] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...