# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
640784 | 2022-09-15T08:16:06 Z | Baytoro | Intercastellar (JOI22_ho_t1) | C++17 | 80 ms | 5336 KB |
#include <bits/stdc++.h> using namespace std; #define Baytoro_Mayrambekov void solve() #define ios ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define int long long #define endl '\n' const int INF=1e18; void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int binpow(int a,int n){ if(n==0) return 1; if(n%2==1) return binpow(a, n-1)*a; else{ int b=binpow(a, n/2); return b*b; } } int f(int x){ int res=1; while(x%2==0){ x/=2; res*=2; } return res; } int get(int x){ while(x%2==0) x/=2; return x; } int a,b,c,n,m,i,j,k,x,y,cnt=0,sum=0,res=0; Baytoro_Mayrambekov{ cin>>n; vector<pair<int,int>> vec(n+1); for(i=1;i<=n;i++){ cin>>vec[i].fr; vec[i].sc=f(vec[i].fr); } for(i=1;i<=n;i++){ vec[i].sc+=vec[i-1].sc; } int q; cin>>q; while(q--){ cin>>x; int l=1,r=n; while(l<r){ int md=(l+r)/2; if(vec[md].sc<x) l=md+1; else r=md; } cout<<get(vec[l].fr)<<endl; } } main(){ ios; int T=1; //cin>>T; while(T--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 20 ms | 3340 KB | Output is correct |
4 | Correct | 32 ms | 1320 KB | Output is correct |
5 | Correct | 52 ms | 3740 KB | Output is correct |
6 | Correct | 35 ms | 3096 KB | Output is correct |
7 | Correct | 51 ms | 3840 KB | Output is correct |
8 | Correct | 49 ms | 3848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 20 ms | 3340 KB | Output is correct |
4 | Correct | 32 ms | 1320 KB | Output is correct |
5 | Correct | 52 ms | 3740 KB | Output is correct |
6 | Correct | 35 ms | 3096 KB | Output is correct |
7 | Correct | 51 ms | 3840 KB | Output is correct |
8 | Correct | 49 ms | 3848 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 29 ms | 1896 KB | Output is correct |
24 | Correct | 36 ms | 3368 KB | Output is correct |
25 | Correct | 66 ms | 5336 KB | Output is correct |
26 | Correct | 45 ms | 2828 KB | Output is correct |
27 | Correct | 41 ms | 3020 KB | Output is correct |
28 | Correct | 80 ms | 4552 KB | Output is correct |
29 | Correct | 75 ms | 3732 KB | Output is correct |
30 | Correct | 41 ms | 1364 KB | Output is correct |
31 | Correct | 77 ms | 4340 KB | Output is correct |