Submission #662268

#TimeUsernameProblemLanguageResultExecution timeMemory
662268fatemetmhrAbracadabra (CEOI22_abracadabra)C++17
0 / 100
3098 ms15868 KiB
// heiy ... ye rooze jadid ... #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() #define pb push_back #define fi first #define se second const int maxn5 = 1e6 + 10; const int maxnt = 1e6 + 10; int sum[maxnt], a[maxn5], tmp[maxn5], ans[maxn5], per[maxn5]; int rig[maxn5], sz[maxn5], t[maxn5], ind[maxn5]; bool mark[maxn5]; vector <int> av; inline bool cmp(int i, int j){return t[i] < t[j];} inline bool merge(int n){ int p1 = 0, p2 = n / 2, ind = 0; while(ind < n){ if(p1 < n / 2 && (p2 == n || a[p1] < a[p2])) tmp[ind++] = a[p1++]; else tmp[ind++] = a[p2++]; } bool re = true; for(int i = 0; i < n; i++){ re &= (a[i] == tmp[i]); a[i] = tmp[i]; } return re; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < q; i++){ cin >> t[i] >> ind[i]; per[i] = i; } sort(per, per + q, cmp); // bar hasbe t[i] int done = 0; bool re = false; for(int i = 0; i < q; i++){ while(done < t[per[i]] && !re){ done++; bool re = merge(n); } ans[per[i]] = a[ind[per[i]] - 1]; } for(int i = 0; i < q; i++) cout << ans[i] << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:57:18: warning: unused variable 're' [-Wunused-variable]
   57 |             bool re = merge(n);
      |                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...