Submission #700189

# Submission time Handle Problem Language Result Execution time Memory
700189 2023-02-18T19:29:44 Z Toxtaq Intercastellar (JOI22_ho_t1) C++17
100 / 100
78 ms 2892 KB
#include<cstdio>
#include<vector>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    vector<int>v(n);
    for(int i = 0;i < n;++i)scanf("%d", &v[i]);
    long long indx = -1, tempo = 0;
    int q;
    scanf("%d", &q);
    while(q--){
        long long x;
        scanf("%lld", &x);
        int tmp;
        while(tempo < x && indx + 1 < n){
            indx++;
            tmp = v[indx];
            while(tmp % 2 == 0){
                tmp /= 2;
            }
            tempo += v[indx] / tmp;
        }
        printf("%d\n", tmp);
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:9:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     for(int i = 0;i < n;++i)scanf("%d", &v[i]);
      |                             ~~~~~^~~~~~~~~~~~~
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lld", &x);
      |         ~~~~~^~~~~~~~~~~~
# 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 23 ms 1052 KB Output is correct
4 Correct 32 ms 776 KB Output is correct
5 Correct 57 ms 1404 KB Output is correct
6 Correct 33 ms 1080 KB Output is correct
7 Correct 54 ms 1356 KB Output is correct
8 Correct 57 ms 1464 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 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 0 ms 212 KB Output is correct
8 Correct 1 ms 212 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 212 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 212 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 23 ms 1052 KB Output is correct
4 Correct 32 ms 776 KB Output is correct
5 Correct 57 ms 1404 KB Output is correct
6 Correct 33 ms 1080 KB Output is correct
7 Correct 54 ms 1356 KB Output is correct
8 Correct 57 ms 1464 KB Output is correct
9 Correct 0 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 0 ms 212 KB Output is correct
16 Correct 1 ms 212 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 212 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 212 KB Output is correct
23 Correct 29 ms 1492 KB Output is correct
24 Correct 34 ms 1556 KB Output is correct
25 Correct 68 ms 2892 KB Output is correct
26 Correct 45 ms 1356 KB Output is correct
27 Correct 43 ms 1276 KB Output is correct
28 Correct 77 ms 2092 KB Output is correct
29 Correct 78 ms 1344 KB Output is correct
30 Correct 40 ms 976 KB Output is correct
31 Correct 76 ms 1964 KB Output is correct