Submission #894223

# Submission time Handle Problem Language Result Execution time Memory
894223 2023-12-28T02:58:17 Z box Intercastellar (JOI22_ho_t1) C++17
100 / 100
88 ms 7716 KB
#include <array>
#include <iostream>
using namespace std;
 
#define ar array
 
const int N = 2e5;
 
int main() {
  int n;
  scanf("%d", &n);
  static ar<int, 2> a[N];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i][0]);
    a[i][1] = 1;
    while (a[i][0] % 2 == 0) a[i][0] /= 2, a[i][1] *= 2;
  }
  int i = 0;
  long long p = 0;
  int q;
  scanf("%d", &q);
  while (q--) {
    long long x;
    scanf("%lld", &x);
    x -= p;
    while (a[i][1] < x) x -= a[i][1], p += a[i][1], i++;
    printf("%d\n", a[i][0]);
  }
  return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
Main.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d", &a[i][0]);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%d", &q);
      |   ~~~~~^~~~~~~~~~
Main.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%lld", &x);
      |     ~~~~~^~~~~~~~~~~~
# 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 27 ms 2588 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 49 ms 3900 KB Output is correct
6 Correct 29 ms 2896 KB Output is correct
7 Correct 54 ms 4004 KB Output is correct
8 Correct 83 ms 4208 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 1 ms 440 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 456 KB Output is correct
7 Correct 1 ms 348 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 348 KB Output is correct
13 Correct 1 ms 348 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 27 ms 2588 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 49 ms 3900 KB Output is correct
6 Correct 29 ms 2896 KB Output is correct
7 Correct 54 ms 4004 KB Output is correct
8 Correct 83 ms 4208 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 440 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 456 KB Output is correct
15 Correct 1 ms 348 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 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 26 ms 2900 KB Output is correct
24 Correct 30 ms 4180 KB Output is correct
25 Correct 88 ms 7152 KB Output is correct
26 Correct 51 ms 4696 KB Output is correct
27 Correct 35 ms 4544 KB Output is correct
28 Correct 68 ms 7568 KB Output is correct
29 Correct 65 ms 7060 KB Output is correct
30 Correct 36 ms 3668 KB Output is correct
31 Correct 84 ms 7716 KB Output is correct