답안 #717180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717180 2023-04-01T11:09:41 Z meoww Intercastellar (JOI22_ho_t1) C++14
100 / 100
94 ms 12484 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
int mod=1e9+7;
const int N=2e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;

int n;
vector<pair<int,int> > v;

void cl(int x) {
  int nm=x;
  while (nm%2==0) {
    nm/=2;
  }
  v.push_back({x/nm,nm});
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(".in", "r", stdin); freopen(".out", "w", stdout);

    cin>>n;
    for (int i=0;i<n;i++) {
      int x; cin>>x;
      cl(x);
    }
    pair<int,int> prfx[n+1];
    for (int i=1;i<=n;i++) {
      prfx[i].first=v[i-1].first+prfx[i-1].first;
      prfx[i].second=v[i-1].second;
    }

    int q; cin>>q;
    while (q--) {
      int x; cin>>x;
      pair<int,int> tmp={x,0};
      int i=upper_bound(prfx+1,prfx+(n+1),tmp)-prfx+1;
      i--;
      cout<<prfx[i].second<<endl;
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 23 ms 7116 KB Output is correct
4 Correct 32 ms 3232 KB Output is correct
5 Correct 56 ms 8772 KB Output is correct
6 Correct 32 ms 6840 KB Output is correct
7 Correct 56 ms 8840 KB Output is correct
8 Correct 57 ms 8836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 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 320 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 1 ms 212 KB Output is correct
3 Correct 23 ms 7116 KB Output is correct
4 Correct 32 ms 3232 KB Output is correct
5 Correct 56 ms 8772 KB Output is correct
6 Correct 32 ms 6840 KB Output is correct
7 Correct 56 ms 8840 KB Output is correct
8 Correct 57 ms 8836 KB Output is correct
9 Correct 1 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 320 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 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 320 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 37 ms 3664 KB Output is correct
24 Correct 38 ms 7524 KB Output is correct
25 Correct 69 ms 11988 KB Output is correct
26 Correct 51 ms 7728 KB Output is correct
27 Correct 47 ms 7904 KB Output is correct
28 Correct 94 ms 12484 KB Output is correct
29 Correct 84 ms 11908 KB Output is correct
30 Correct 46 ms 4240 KB Output is correct
31 Correct 89 ms 12396 KB Output is correct