Submission #920943

# Submission time Handle Problem Language Result Execution time Memory
920943 2024-02-03T08:14:41 Z Xiaoyang Intercastellar (JOI22_ho_t1) C++17
100 / 100
56 ms 9280 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
 
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 1ll<<60
#define rep(i,a,b) for (ll i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
#define endl "\n"
void inc(ll &a,ll b) {a=(a+b)%mod;}
void dec(ll &a,ll b) {a=(a-b+mod)%mod;}
int prod(ll a,ll b) {return ll(a)*ll(b)%mod;}
int lowbit(ll x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}


const ll maxn=2e5+5;
ll a[maxn],qq[maxn];

ll p=1,pp=1;
ll n,q;



signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	rep(i,1,n+1)cin>>a[i];
	cin>>q;
	rep(i,1,q+1)cin>>qq[i];
	rep(i,1,n+1){
		if(a[i]&1){
			p++;
		}else{
			ll cnt=1;
			while(a[i]%2!=1){
				a[i]/=2;
				cnt*=2;
			}
			p+=cnt;
		}
		while(p>qq[pp] and pp<=q){
			cout<<a[i]<<endl;
			pp++;
		}
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4184 KB Output is correct
4 Correct 20 ms 3868 KB Output is correct
5 Correct 34 ms 5456 KB Output is correct
6 Correct 22 ms 4432 KB Output is correct
7 Correct 35 ms 5724 KB Output is correct
8 Correct 35 ms 5596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2524 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 2 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 15 ms 4184 KB Output is correct
4 Correct 20 ms 3868 KB Output is correct
5 Correct 34 ms 5456 KB Output is correct
6 Correct 22 ms 4432 KB Output is correct
7 Correct 35 ms 5724 KB Output is correct
8 Correct 35 ms 5596 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2524 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 18 ms 4700 KB Output is correct
24 Correct 24 ms 5724 KB Output is correct
25 Correct 45 ms 8952 KB Output is correct
26 Correct 31 ms 6228 KB Output is correct
27 Correct 30 ms 5972 KB Output is correct
28 Correct 56 ms 9204 KB Output is correct
29 Correct 53 ms 8820 KB Output is correct
30 Correct 27 ms 5716 KB Output is correct
31 Correct 54 ms 9280 KB Output is correct