Submission #756537

# Submission time Handle Problem Language Result Execution time Memory
756537 2023-06-11T20:20:24 Z michao Intercastellar (JOI22_ho_t1) C++14
100 / 100
84 ms 15480 KB
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=2e5+5;
pii query[MAX];
int ans[MAX];
int a[MAX];
int num[MAX],ile[MAX];
int32_t main()
{
  BOOST;
  int n;
  cin>>n;
  for (int i=1;i<=n;i++)cin>>a[i];
  for (int i=1;i<=n;i++){
    num[i]=a[i],ile[i]=1;
    while (num[i]%2==0)num[i]/=2,ile[i]*=2;
  }
  int q;
  cin>>q;
  for (int i=1;i<=q;i++){
    cin>>query[i].st;
    query[i].nd=i;
  }
  sort(query+1,query+1+q);
  int sum=0,wsk=0;
  for (int i=1;i<=q;i++){
    int id=query[i].nd;
    while (sum<query[i].st){
      wsk++;
      sum+=ile[wsk];
    }
    ans[id]=num[wsk];
  }

  for (int i=1;i<=q;i++)cout<<ans[i]<<"\n";
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 19 ms 6344 KB Output is correct
4 Correct 35 ms 6220 KB Output is correct
5 Correct 51 ms 11776 KB Output is correct
6 Correct 31 ms 7628 KB Output is correct
7 Correct 48 ms 11728 KB Output is correct
8 Correct 45 ms 11932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 412 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 19 ms 6344 KB Output is correct
4 Correct 35 ms 6220 KB Output is correct
5 Correct 51 ms 11776 KB Output is correct
6 Correct 31 ms 7628 KB Output is correct
7 Correct 48 ms 11728 KB Output is correct
8 Correct 45 ms 11932 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 340 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 340 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 412 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 34 ms 6104 KB Output is correct
24 Correct 33 ms 8272 KB Output is correct
25 Correct 59 ms 14968 KB Output is correct
26 Correct 43 ms 9084 KB Output is correct
27 Correct 42 ms 8652 KB Output is correct
28 Correct 77 ms 15480 KB Output is correct
29 Correct 77 ms 14952 KB Output is correct
30 Correct 39 ms 7500 KB Output is correct
31 Correct 84 ms 15408 KB Output is correct