# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
855201 | 2023-09-30T15:46:20 Z | ancuber1031 | Intercastellar (JOI22_ho_t1) | C++14 | 77 ms | 10960 KB |
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define p_q priority_queue #define endl '\n' #define pb push_back signed main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin>>n; vector<int> a(n); deque<int> ans, ps; for (auto& i : a) cin>>i; while(!a.empty()) { int cur = a.back(), cnt = 1; a.pop_back(); while(cur&1^1) { cur >>= 1; cnt <<= 1; } ans.push_front(cur); ps.push_front(cnt); } //for (int i = 0; i < ps.size(); ++i) cout<<ans[i]<<' '<<ps[i]<<endl; for (int i = 1; i < ps.size(); ++i) ps[i] += ps[i-1]; int q; cin>>q; while(q--) { int x; cin>>x; int l = -1, r = ps.size()+1; while(r-l > 1) { int mid = (l+r)>>1; if (ps[mid] < x) l = mid; else r = mid; } //cout<<ps[l]<<' '<<ps[r]<<endl; cout<<ans[r]<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 18 ms | 5300 KB | Output is correct |
4 | Correct | 27 ms | 2660 KB | Output is correct |
5 | Correct | 52 ms | 6624 KB | Output is correct |
6 | Correct | 27 ms | 5456 KB | Output is correct |
7 | Correct | 47 ms | 6484 KB | Output is correct |
8 | Correct | 47 ms | 6936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 512 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 18 ms | 5300 KB | Output is correct |
4 | Correct | 27 ms | 2660 KB | Output is correct |
5 | Correct | 52 ms | 6624 KB | Output is correct |
6 | Correct | 27 ms | 5456 KB | Output is correct |
7 | Correct | 47 ms | 6484 KB | Output is correct |
8 | Correct | 47 ms | 6936 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 512 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 26 ms | 3488 KB | Output is correct |
24 | Correct | 33 ms | 6432 KB | Output is correct |
25 | Correct | 67 ms | 10428 KB | Output is correct |
26 | Correct | 37 ms | 6796 KB | Output is correct |
27 | Correct | 34 ms | 6740 KB | Output is correct |
28 | Correct | 77 ms | 10960 KB | Output is correct |
29 | Correct | 62 ms | 10580 KB | Output is correct |
30 | Correct | 36 ms | 4076 KB | Output is correct |
31 | Correct | 66 ms | 10788 KB | Output is correct |