Submission #916018

# Submission time Handle Problem Language Result Execution time Memory
916018 2024-01-25T06:40:54 Z yeediot Intercastellar (JOI22_ho_t1) C++14
100 / 100
64 ms 11000 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define pb push_back
#define pii pair<int,int>
#define all(X) X.begin(),X.end()
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#ifdef local
void setio(){freopen("/Users/iantsai/Library/Mobile Documents/com~apple~CloudDocs/cpp/Empty.md","r",stdin);}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
void setio(){}
#define debug(x...)
#endif
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    setio();
    int n;
    cin>>n;
    vector<int>v;
    vector<int>cnt(n);
    vector<int>ans(n);
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        v.pb(x);
        int tmp=0;
        //cout<<x<<' ';
        while((x>>tmp&1)==0)tmp++;
        cnt[i]=(1ll<<tmp);
        ans[i]=x/cnt[i];
        //cout<<cnt[i]<<' ';
    }
    int q;
    cin>>q;
    int p=0,cur=0;
    for(int i=0;i<q;i++){
        int x;
        cin>>x;
        while(x>cnt[p]+cur){
            cur+=cnt[p];
            p++;
        }
        cout<<ans[p]<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 6156 KB Output is correct
4 Correct 20 ms 3016 KB Output is correct
5 Correct 36 ms 7384 KB Output is correct
6 Correct 22 ms 5592 KB Output is correct
7 Correct 36 ms 7368 KB Output is correct
8 Correct 36 ms 7308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 468 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 6156 KB Output is correct
4 Correct 20 ms 3016 KB Output is correct
5 Correct 36 ms 7384 KB Output is correct
6 Correct 22 ms 5592 KB Output is correct
7 Correct 36 ms 7368 KB Output is correct
8 Correct 36 ms 7308 KB Output is correct
9 Correct 0 ms 344 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 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 468 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 20 ms 3540 KB Output is correct
24 Correct 27 ms 6476 KB Output is correct
25 Correct 49 ms 10436 KB Output is correct
26 Correct 33 ms 6864 KB Output is correct
27 Correct 32 ms 6856 KB Output is correct
28 Correct 64 ms 10956 KB Output is correct
29 Correct 60 ms 10300 KB Output is correct
30 Correct 28 ms 4192 KB Output is correct
31 Correct 55 ms 11000 KB Output is correct