Submission #692220

# Submission time Handle Problem Language Result Execution time Memory
692220 2023-02-01T08:23:12 Z bdl Intercastellar (JOI22_ho_t1) C++17
100 / 100
115 ms 7628 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#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:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
Main.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d", &a[i][0]);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   scanf("%d", &q);
      |   ~~~~~^~~~~~~~~~
Main.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%lld", &x);
      |     ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 23 ms 2388 KB Output is correct
4 Correct 45 ms 1952 KB Output is correct
5 Correct 59 ms 3948 KB Output is correct
6 Correct 42 ms 2716 KB Output is correct
7 Correct 59 ms 3916 KB Output is correct
8 Correct 58 ms 4064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 23 ms 2388 KB Output is correct
4 Correct 45 ms 1952 KB Output is correct
5 Correct 59 ms 3948 KB Output is correct
6 Correct 42 ms 2716 KB Output is correct
7 Correct 59 ms 3916 KB Output is correct
8 Correct 58 ms 4064 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 316 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
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 320 KB Output is correct
22 Correct 1 ms 324 KB Output is correct
23 Correct 35 ms 2704 KB Output is correct
24 Correct 42 ms 4028 KB Output is correct
25 Correct 73 ms 7192 KB Output is correct
26 Correct 72 ms 4484 KB Output is correct
27 Correct 66 ms 4392 KB Output is correct
28 Correct 85 ms 7628 KB Output is correct
29 Correct 85 ms 7108 KB Output is correct
30 Correct 49 ms 3504 KB Output is correct
31 Correct 115 ms 7480 KB Output is correct