Submission #975342

# Submission time Handle Problem Language Result Execution time Memory
975342 2024-05-04T22:11:24 Z Isam Intercastellar (JOI22_ho_t1) C++17
25 / 100
428 ms 524288 KB
#include<bits/stdc++.h>
using namespace std;

constexpr int sz = 2e5 + 5;

long long n, a[sz], Q, x;

vector<long long> em;

signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(register int i = 1; i <= n; ++i){
		cin >> a[i];
	}
	
	for(register int i = 1; i <= n; ++i){
		if(a[i] & 1) em.emplace_back(a[i]);
		else{
			long long cnt(1);
			while(a[i] % 2 == 0){
				cnt <<= 1LL;
				a[i] >>= 1LL;
			}
			while(cnt--) em.emplace_back(a[i]);
		}
	}
	cin >> Q;
	while(Q--){
		cin >> x;
		cout << em[x-1] << '\n';
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:13:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |  for(register int i = 1; i <= n; ++i){
      |                   ^
Main.cpp:17:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |  for(register int i = 1; i <= n; ++i){
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 8748 KB Output is correct
4 Correct 21 ms 3032 KB Output is correct
5 Correct 36 ms 8404 KB Output is correct
6 Correct 27 ms 12240 KB Output is correct
7 Correct 48 ms 11724 KB Output is correct
8 Correct 43 ms 19660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Runtime error 428 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 8748 KB Output is correct
4 Correct 21 ms 3032 KB Output is correct
5 Correct 36 ms 8404 KB Output is correct
6 Correct 27 ms 12240 KB Output is correct
7 Correct 48 ms 11724 KB Output is correct
8 Correct 43 ms 19660 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Runtime error 428 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -