Submission #638700

# Submission time Handle Problem Language Result Execution time Memory
638700 2022-09-07T04:08:57 Z jamezzz Intercastellar (JOI22_ho_t1) C++17
100 / 100
93 ms 6988 KB
#include <bits/stdc++.h>
using namespace std;

#define pf printf
#define sf scanf
typedef long long ll;
typedef pair<int,int> ii;

#define maxn 200005

int n,q,a[maxn];
ll x;

int main(){
	sf("%d",&n);
	for(int i=0;i<n;++i){
		sf("%d",&a[i]);
	}
	int cur=-1;ll num=0;
	sf("%d",&q);
	for(int i=0;i<q;++i){
		sf("%lld",&x);
		while(num<x){
			++cur;
			ll tmp=1;
			while(a[cur]%2==0){
				tmp<<=1;
				a[cur]>>=1;
			}
			num+=tmp;
		}
		printf("%d\n",a[cur]);
	}
}

/*
4
14
9
8
12
6
2
3
5
7
11
13
*/

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:15:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  sf("%d",&n);
      |    ^
Main.cpp:17:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   sf("%d",&a[i]);
      |     ^
Main.cpp:20:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  sf("%d",&q);
      |    ^
Main.cpp:22:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   sf("%lld",&x);
      |     ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 1716 KB Output is correct
4 Correct 32 ms 1704 KB Output is correct
5 Correct 57 ms 3196 KB Output is correct
6 Correct 32 ms 1996 KB Output is correct
7 Correct 53 ms 3124 KB Output is correct
8 Correct 53 ms 3188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 320 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 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 25 ms 1716 KB Output is correct
4 Correct 32 ms 1704 KB Output is correct
5 Correct 57 ms 3196 KB Output is correct
6 Correct 32 ms 1996 KB Output is correct
7 Correct 53 ms 3124 KB Output is correct
8 Correct 53 ms 3188 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 312 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 320 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 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 324 KB Output is correct
23 Correct 38 ms 2596 KB Output is correct
24 Correct 33 ms 3580 KB Output is correct
25 Correct 68 ms 6364 KB Output is correct
26 Correct 43 ms 4020 KB Output is correct
27 Correct 41 ms 3760 KB Output is correct
28 Correct 82 ms 6988 KB Output is correct
29 Correct 75 ms 6260 KB Output is correct
30 Correct 43 ms 3320 KB Output is correct
31 Correct 93 ms 6696 KB Output is correct