답안 #784868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
784868 2023-07-16T16:02:48 Z Arpenteur Intercastellar (JOI22_ho_t1) C++17
100 / 100
62 ms 9284 KB
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using pli = pair<ll,int>;
const char el = '\n';

int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pli> PL; // position, length
  ll cur_pos = 1LL;
  for(int i=0, a, b, div; i<n; i++) {
    cin >> a;
    b = a;
    div = 1;
    while((b&1)==0) {
      b >>= 1;
      div <<= 1;
    }
    PL.push_back({cur_pos,a/div});
    cur_pos += div;
  }
  int q;
  cin >> q;
  int pos;
  ll x;
  while(q--) {
    cin >> x;
    auto f = [&] (pli& pl) { return x>=pl.first; };
    pos = distance(PL.begin(),
        partition_point(PL.begin(),PL.end(),f));
    pos--;
    cout << PL[pos].second << el;
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 18 ms 5068 KB Output is correct
4 Correct 25 ms 2504 KB Output is correct
5 Correct 42 ms 5636 KB Output is correct
6 Correct 25 ms 5068 KB Output is correct
7 Correct 43 ms 5660 KB Output is correct
8 Correct 41 ms 5780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 324 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 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 340 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 324 KB Output is correct
3 Correct 18 ms 5068 KB Output is correct
4 Correct 25 ms 2504 KB Output is correct
5 Correct 42 ms 5636 KB Output is correct
6 Correct 25 ms 5068 KB Output is correct
7 Correct 43 ms 5660 KB Output is correct
8 Correct 41 ms 5780 KB Output is correct
9 Correct 1 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 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 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 340 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 328 KB Output is correct
23 Correct 23 ms 3180 KB Output is correct
24 Correct 30 ms 6076 KB Output is correct
25 Correct 55 ms 8952 KB Output is correct
26 Correct 36 ms 5616 KB Output is correct
27 Correct 33 ms 6040 KB Output is correct
28 Correct 62 ms 9268 KB Output is correct
29 Correct 58 ms 8820 KB Output is correct
30 Correct 32 ms 3840 KB Output is correct
31 Correct 61 ms 9284 KB Output is correct