답안 #710772

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710772 2023-03-15T18:18:41 Z mdub Intercastellar (JOI22_ho_t1) C++14
100 / 100
525 ms 20244 KB
#include <bits/stdc++.h>

using namespace std;

int main () {
  int n; cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<pair<long long, long long>> s;
  long long pos = 0;
  for (auto elem: a) {
    int count = 1; 
    
    while (elem % 2 == 0) {
      count *= 2;
      elem /= 2;
    }
    s.insert({pos, elem});
    pos += count;
  }
  int q; cin >> q;
  for (int i = 0; i < q; i++) {
    long long query; cin >> query;
    query--;
    auto it = (s.upper_bound({query, 1e18}));
    it--;
    cout << (*it).second << '\n';
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 148 ms 14480 KB Output is correct
4 Correct 258 ms 4968 KB Output is correct
5 Correct 437 ms 16436 KB Output is correct
6 Correct 219 ms 13240 KB Output is correct
7 Correct 423 ms 16692 KB Output is correct
8 Correct 403 ms 16572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 4 ms 340 KB Output is correct
12 Correct 4 ms 312 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 148 ms 14480 KB Output is correct
4 Correct 258 ms 4968 KB Output is correct
5 Correct 437 ms 16436 KB Output is correct
6 Correct 219 ms 13240 KB Output is correct
7 Correct 423 ms 16692 KB Output is correct
8 Correct 403 ms 16572 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 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 1 ms 300 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Correct 4 ms 340 KB Output is correct
20 Correct 4 ms 312 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 3 ms 396 KB Output is correct
23 Correct 256 ms 4772 KB Output is correct
24 Correct 230 ms 12912 KB Output is correct
25 Correct 462 ms 19660 KB Output is correct
26 Correct 279 ms 12532 KB Output is correct
27 Correct 244 ms 13424 KB Output is correct
28 Correct 517 ms 20244 KB Output is correct
29 Correct 525 ms 19596 KB Output is correct
30 Correct 292 ms 5004 KB Output is correct
31 Correct 501 ms 20044 KB Output is correct