Submission #648165

# Submission time Handle Problem Language Result Execution time Memory
648165 2022-10-05T15:23:37 Z baibhav26062008 Intercastellar (JOI22_ho_t1) C++14
25 / 100
994 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;cin>>N;
	int A[N];
	for (int i=0; i<N; i++) {
		cin >> A[i];
	}
	int Q; cin>>Q;
	int X[Q];
	for (int i=0; i<Q; i++) {
		cin >> X[i];
	}
	vector<int>L;
	for (int i = 0; i < N; i++) {
		int curr = A[i];
		int ctr = 0;
		while (curr % 2 == 0) {
			curr /= 2;
		}
		for (int j = 0; j < (A[i]/curr); j++) {
			L.push_back(curr);
		}
		// (aL.push_back(curr);
		// (A[i] % 2 != 0) L.push_back(curr);
	}
 	//for (int x: L) cout << x << endl;
 	for (int i = 0; i < Q; i++) {
		cout << L[X[i]-1] << endl;
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:18:7: warning: unused variable 'ctr' [-Wunused-variable]
   18 |   int ctr = 0;
      |       ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 86 ms 3952 KB Output is correct
4 Correct 241 ms 2912 KB Output is correct
5 Correct 357 ms 6156 KB Output is correct
6 Correct 177 ms 6520 KB Output is correct
7 Correct 375 ms 7800 KB Output is correct
8 Correct 362 ms 12036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 994 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 86 ms 3952 KB Output is correct
4 Correct 241 ms 2912 KB Output is correct
5 Correct 357 ms 6156 KB Output is correct
6 Correct 177 ms 6520 KB Output is correct
7 Correct 375 ms 7800 KB Output is correct
8 Correct 362 ms 12036 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Runtime error 994 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -