# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938630 | 2024-03-05T11:28:11 Z | vjudge1 | Intercastellar (JOI22_ho_t1) | C++17 | 463 ms | 7748 KB |
#include <bits/stdc++.h> #define int long long #define endl "\n" using namespace std; vector<int>prefix; int binarysearch(int i){ int r=prefix.size(); int l=0; while(l<r){ if(l==r-1){ if(prefix[r]<=i)return r; else return l; } int m=(l+r)/2; if(prefix[m]==i)return m; if(prefix[m]>i) r=m; else l=m; } } pair<int,int> power(int i){ int ans=1; while(i%ans==0){ ans*=2; } ans/=2; i=i/ans; return make_pair(ans,i); } signed main(){ int n,q; cin>>n; int sum=1; vector<int>v; prefix.push_back(sum); for(int i=0;i<n;i++){ int a; cin>>a; pair<int,int>b=power(a); sum+=b.first; prefix.push_back(sum); v.push_back(b.second); } cin>>q; for(int i=0;i<q;i++){ int b; cin>>b; int index=binarysearch(b); cout<<v[index]<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 85 ms | 3704 KB | Output is correct |
4 | Correct | 245 ms | 1532 KB | Output is correct |
5 | Correct | 318 ms | 4072 KB | Output is correct |
6 | Correct | 160 ms | 3524 KB | Output is correct |
7 | Correct | 312 ms | 4084 KB | Output is correct |
8 | Correct | 313 ms | 5328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 440 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 760 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 2 ms | 448 KB | Output is correct |
9 | Correct | 1 ms | 356 KB | Output is correct |
10 | Correct | 1 ms | 352 KB | Output is correct |
11 | Correct | 2 ms | 468 KB | Output is correct |
12 | Correct | 2 ms | 448 KB | Output is correct |
13 | Correct | 1 ms | 504 KB | Output is correct |
14 | Correct | 3 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 85 ms | 3704 KB | Output is correct |
4 | Correct | 245 ms | 1532 KB | Output is correct |
5 | Correct | 318 ms | 4072 KB | Output is correct |
6 | Correct | 160 ms | 3524 KB | Output is correct |
7 | Correct | 312 ms | 4084 KB | Output is correct |
8 | Correct | 313 ms | 5328 KB | Output is correct |
9 | Correct | 1 ms | 440 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 760 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 2 ms | 448 KB | Output is correct |
17 | Correct | 1 ms | 356 KB | Output is correct |
18 | Correct | 1 ms | 352 KB | Output is correct |
19 | Correct | 2 ms | 468 KB | Output is correct |
20 | Correct | 2 ms | 448 KB | Output is correct |
21 | Correct | 1 ms | 504 KB | Output is correct |
22 | Correct | 3 ms | 348 KB | Output is correct |
23 | Correct | 192 ms | 3060 KB | Output is correct |
24 | Correct | 173 ms | 4824 KB | Output is correct |
25 | Correct | 361 ms | 7748 KB | Output is correct |
26 | Correct | 219 ms | 4544 KB | Output is correct |
27 | Correct | 191 ms | 4996 KB | Output is correct |
28 | Correct | 463 ms | 7520 KB | Output is correct |
29 | Correct | 427 ms | 7164 KB | Output is correct |
30 | Correct | 258 ms | 3272 KB | Output is correct |
31 | Correct | 420 ms | 7600 KB | Output is correct |