Submission #910526

# Submission time Handle Problem Language Result Execution time Memory
910526 2024-01-18T05:39:49 Z SuPythony Intercastellar (JOI22_ho_t1) C++17
100 / 100
385 ms 5320 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n; cin>>n;
    vector<ll> p(n);
    ll m=0;
    for (int i=0; i<n; i++) {
        cin>>p[i];
    }
    vector<ll> c(n);
    for (int i=0; i<n; i++) {
        if (i==0) {
            c[i]=p[i]&-p[i];
        } else {
            c[i]=c[i-1]+(p[i]&-p[i]);
        }
    } 
    int q; cin>>q;
    while (q--) {
        ll x; cin>>x;
        auto it=lower_bound(c.begin(),c.end(),x);
        int ind=it-c.begin();
        ll n;
        if (ind==0) n=*it;
        else n=*it-c[ind-1];
        if (n==1) cout<<p[ind]<<"\n";
        else if (n==p[ind]) cout<<1<<"\n";
        else cout<<p[ind]/n<<"\n";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:8: warning: unused variable 'm' [-Wunused-variable]
    8 |     ll m=0;
      |        ^
# 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 75 ms 3488 KB Output is correct
4 Correct 215 ms 1360 KB Output is correct
5 Correct 342 ms 3920 KB Output is correct
6 Correct 153 ms 3096 KB Output is correct
7 Correct 308 ms 3792 KB Output is correct
8 Correct 306 ms 3816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 4 ms 348 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 75 ms 3488 KB Output is correct
4 Correct 215 ms 1360 KB Output is correct
5 Correct 342 ms 3920 KB Output is correct
6 Correct 153 ms 3096 KB Output is correct
7 Correct 308 ms 3792 KB Output is correct
8 Correct 306 ms 3816 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 344 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 180 ms 2036 KB Output is correct
24 Correct 161 ms 3228 KB Output is correct
25 Correct 342 ms 5320 KB Output is correct
26 Correct 213 ms 3152 KB Output is correct
27 Correct 174 ms 3080 KB Output is correct
28 Correct 385 ms 4692 KB Output is correct
29 Correct 367 ms 3924 KB Output is correct
30 Correct 250 ms 1424 KB Output is correct
31 Correct 368 ms 4432 KB Output is correct