답안 #807711

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
807711 2023-08-04T22:34:08 Z dong_liu Intercastellar (JOI22_ho_t1) C++17
100 / 100
77 ms 7628 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);
      |     ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 220 KB Output is correct
3 Correct 20 ms 2388 KB Output is correct
4 Correct 29 ms 1868 KB Output is correct
5 Correct 49 ms 3952 KB Output is correct
6 Correct 29 ms 2640 KB Output is correct
7 Correct 49 ms 3912 KB Output is correct
8 Correct 48 ms 4060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 324 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 324 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 220 KB Output is correct
3 Correct 20 ms 2388 KB Output is correct
4 Correct 29 ms 1868 KB Output is correct
5 Correct 49 ms 3952 KB Output is correct
6 Correct 29 ms 2640 KB Output is correct
7 Correct 49 ms 3912 KB Output is correct
8 Correct 48 ms 4060 KB Output is correct
9 Correct 0 ms 316 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 324 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 324 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 320 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 26 ms 2704 KB Output is correct
24 Correct 31 ms 4104 KB Output is correct
25 Correct 77 ms 7264 KB Output is correct
26 Correct 38 ms 4532 KB Output is correct
27 Correct 35 ms 4428 KB Output is correct
28 Correct 66 ms 7628 KB Output is correct
29 Correct 66 ms 7072 KB Output is correct
30 Correct 36 ms 3452 KB Output is correct
31 Correct 67 ms 7528 KB Output is correct