답안 #941825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941825 2024-03-09T14:02:41 Z ErJ Intercastellar (JOI22_ho_t1) C++17
100 / 100
431 ms 10696 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<pair<ll, ll>>
#define pp pair<ll, ll>
#define qi queue<ll>
#define qp queue<pp>
#define pqi priority_queue<ll>
#define pqp priority_queue<pp>
#define mi map<ll, ll>
#define mpi map<pp, ll>
#define mip map<ll, pp>
#define mpp map<pp, pp>
#define mb map<ll, bool>
#define si set<ll>
#define sp set<pp>
#define mod 1000000007
#define rep(a, b) for(int a = 0; a < (b); a++)
#define rep2(a, b) for(int a = 1; a < (b); a++)
#define inf 100000000000000

int main()
{
	int n;
	cin >> n;
	vi input(n);
	vp spare(n); //count, length
	rep(i, n) {
		cin >> input[i];
		ll x = 1;
		while (input[i] % 2 == 0) {
			x *= 2;
			input[i] /= 2;
		}
		spare[i] = { x, input[i] };
	}
	int q;
	cin >> q;
	ll akt = 0;
	ll index = -1;
	rep(i, q) {
		ll quest;
		cin >> quest;
		if (quest <= akt) {
			cout << spare[index].second << endl;
		}
		else {
			while (quest > akt) {
				index++;
				akt += spare[index].first;
			}
			cout << spare[index].second << endl;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 74 ms 5468 KB Output is correct
4 Correct 260 ms 2620 KB Output is correct
5 Correct 311 ms 7188 KB Output is correct
6 Correct 172 ms 5484 KB Output is correct
7 Correct 304 ms 7488 KB Output is correct
8 Correct 306 ms 7324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 440 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 456 KB Output is correct
8 Correct 2 ms 544 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 74 ms 5468 KB Output is correct
4 Correct 260 ms 2620 KB Output is correct
5 Correct 311 ms 7188 KB Output is correct
6 Correct 172 ms 5484 KB Output is correct
7 Correct 304 ms 7488 KB Output is correct
8 Correct 306 ms 7324 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 440 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 456 KB Output is correct
16 Correct 2 ms 544 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 187 ms 3264 KB Output is correct
24 Correct 168 ms 6548 KB Output is correct
25 Correct 377 ms 10484 KB Output is correct
26 Correct 238 ms 6796 KB Output is correct
27 Correct 176 ms 6776 KB Output is correct
28 Correct 401 ms 10696 KB Output is correct
29 Correct 370 ms 10320 KB Output is correct
30 Correct 246 ms 4052 KB Output is correct
31 Correct 431 ms 10608 KB Output is correct