# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527993 | 2022-02-19T01:11:54 Z | amukkalir | Intercastellar (JOI22_ho_t1) | C++17 | 2000 ms | 9244 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define prn printf #define scn scanf const int nax = 2e5; ll p[nax+5]; //jumlahnya ll v[nax+5]; // value nya int n; ll binser(ll x) { ll lo = 1, hi = n; ll ret = lo; while(lo <= hi) { int mid = (lo+hi)>>1; if(x <= p[mid]) { ret = mid; hi = mid-1; } else lo = mid+1; } return ret; } signed main () { scn("%d", &n); for(int i=1; i<=n; i++) { ll a; scn("%lld", &a); int cnt = 0; while(a%2==0) { cnt++; a /= 2; } p[i] = 1ll<<cnt; p[i] += p[i-1]; v[i] = a; cerr << i << " " << p[i] << " " << v[i] << endl; } int q; scn("%d", &q); while(q--) { ll x; scn("%lld", &x); cerr << x << " " << binser(x) << endl; prn("%lld\n", v[binser(x)]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1501 ms | 7384 KB | Output is correct |
4 | Correct | 1197 ms | 4676 KB | Output is correct |
5 | Execution timed out | 2083 ms | 9244 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 6 ms | 204 KB | Output is correct |
7 | Correct | 6 ms | 316 KB | Output is correct |
8 | Correct | 13 ms | 304 KB | Output is correct |
9 | Correct | 4 ms | 204 KB | Output is correct |
10 | Correct | 4 ms | 332 KB | Output is correct |
11 | Correct | 14 ms | 348 KB | Output is correct |
12 | Correct | 13 ms | 332 KB | Output is correct |
13 | Correct | 8 ms | 332 KB | Output is correct |
14 | Correct | 13 ms | 456 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1501 ms | 7384 KB | Output is correct |
4 | Correct | 1197 ms | 4676 KB | Output is correct |
5 | Execution timed out | 2083 ms | 9244 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |