Submission #602278

# Submission time Handle Problem Language Result Execution time Memory
602278 2022-07-22T20:27:49 Z IvanJ Intercastellar (JOI22_ho_t1) C++17
100 / 100
120 ms 8552 KB
#include<bits/stdc++.h>

#define pb push_back
#define x first
#define y second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 2e5 + 5;

int n, q;
int A[maxn];

int main() {
	scanf("%d", &n);
	for(int i = 0;i < n;i++) 
		scanf("%d", A + i);
		
	vector<ii> v;
	for(int i = 0;i < n;i++) {
		int x = A[i] & -A[i];
		v.pb({A[i] / x, x});
	}
	
	ll cnt = 0;
	int pos = 0;
	scanf("%d", &q);
	for(int i = 0;i < q;i++) {
		ll x;
		scanf("%lld", &x);
		while(cnt < x) cnt += v[pos++].y;
		printf("%d\n", v[pos - 1].x);
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
Main.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%d", A + i);
      |   ~~~~~^~~~~~~~~~~~~
Main.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  scanf("%d", &q);
      |  ~~~~~^~~~~~~~~~
Main.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |   scanf("%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 3828 KB Output is correct
4 Correct 34 ms 2292 KB Output is correct
5 Correct 61 ms 4780 KB Output is correct
6 Correct 44 ms 3564 KB Output is correct
7 Correct 56 ms 4840 KB Output is correct
8 Correct 57 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 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 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 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 3828 KB Output is correct
4 Correct 34 ms 2292 KB Output is correct
5 Correct 61 ms 4780 KB Output is correct
6 Correct 44 ms 3564 KB Output is correct
7 Correct 56 ms 4840 KB Output is correct
8 Correct 57 ms 4992 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 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 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 34 ms 3032 KB Output is correct
24 Correct 39 ms 4732 KB Output is correct
25 Correct 93 ms 8072 KB Output is correct
26 Correct 50 ms 5116 KB Output is correct
27 Correct 45 ms 5136 KB Output is correct
28 Correct 120 ms 8552 KB Output is correct
29 Correct 78 ms 7980 KB Output is correct
30 Correct 44 ms 3748 KB Output is correct
31 Correct 79 ms 8432 KB Output is correct