Submission #526866

# Submission time Handle Problem Language Result Execution time Memory
526866 2022-02-16T12:37:00 Z eecs Intercastellar (JOI22_ho_t1) C++17
100 / 100
113 ms 8076 KB
#include <bits/stdc++.h>
using namespace std;

const int maxn = 200010;
int n, q, a[maxn];
long long pre[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        int o = a[i];
        while (!(a[i] % 2)) a[i] /= 2;
        pre[i] = pre[i - 1] + o / a[i];
    }
    scanf("%d", &q);
    while (q--) {
        long long x;
        scanf("%lld", &x);
        int i = lower_bound(pre + 1, pre + n + 1, x) - pre;
        printf("%d\n", a[i]);
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
Main.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%lld", &x);
      |         ~~~~~^~~~~~~~~~~~
# 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 28 ms 3036 KB Output is correct
4 Correct 40 ms 1940 KB Output is correct
5 Correct 67 ms 4180 KB Output is correct
6 Correct 51 ms 3292 KB Output is correct
7 Correct 67 ms 4152 KB Output is correct
8 Correct 73 ms 4652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 280 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 320 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 28 ms 3036 KB Output is correct
4 Correct 40 ms 1940 KB Output is correct
5 Correct 67 ms 4180 KB Output is correct
6 Correct 51 ms 3292 KB Output is correct
7 Correct 67 ms 4152 KB Output is correct
8 Correct 73 ms 4652 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 280 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 320 KB Output is correct
23 Correct 34 ms 2608 KB Output is correct
24 Correct 57 ms 4144 KB Output is correct
25 Correct 82 ms 7176 KB Output is correct
26 Correct 59 ms 4772 KB Output is correct
27 Correct 52 ms 4472 KB Output is correct
28 Correct 113 ms 8076 KB Output is correct
29 Correct 95 ms 7180 KB Output is correct
30 Correct 52 ms 3604 KB Output is correct
31 Correct 94 ms 8008 KB Output is correct