답안 #87770

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87770 2018-12-02T11:54:08 Z JustInCase Brunhilda’s Birthday (BOI13_brunhilda) C++17
6.98413 / 100
38 ms 39268 KB
#include <bits/stdc++.h>

const int32_t MAX_N = 1e7;

int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int32_t m, q;
	std::cin >> m >> q;

	int64_t lcm = 1;
	int32_t maxP;
	for(int32_t i = 0; i < m; i++) {
		int32_t p;
		std::cin >> p;

		maxP = std::max(maxP, p);
		if(lcm <= MAX_N) {
			lcm *= (int64_t) p;
		}
	}

	for(int32_t i = 0; i < q; i++) {
		int32_t n;
		std::cin >> n;

		if(n >= lcm) {
			std::cout << "oo" << '\n';
		}
		else {
			if(n % maxP == 0) {
				std::cout << 2 * (n / maxP) << '\n';
			}
			else {
				std::cout << 2 * (n / maxP) + 1 << '\n';
			}
		}
	}
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:13:10: warning: 'maxP' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int32_t maxP;
          ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Incorrect 2 ms 492 KB Output isn't correct
4 Incorrect 4 ms 732 KB Output isn't correct
5 Incorrect 2 ms 732 KB Output isn't correct
6 Incorrect 3 ms 732 KB Output isn't correct
7 Incorrect 3 ms 732 KB Output isn't correct
8 Incorrect 3 ms 888 KB Output isn't correct
9 Incorrect 2 ms 888 KB Output isn't correct
10 Incorrect 1 ms 888 KB Output isn't correct
11 Incorrect 3 ms 888 KB Output isn't correct
12 Correct 1 ms 888 KB Output is correct
13 Incorrect 3 ms 888 KB Output isn't correct
14 Incorrect 4 ms 888 KB Output isn't correct
15 Incorrect 3 ms 888 KB Output isn't correct
16 Incorrect 3 ms 888 KB Output isn't correct
17 Incorrect 4 ms 888 KB Output isn't correct
18 Incorrect 4 ms 924 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 976 KB Output isn't correct
2 Correct 13 ms 1724 KB Output is correct
3 Correct 10 ms 2148 KB Output is correct
4 Incorrect 3 ms 2376 KB Output isn't correct
5 Incorrect 8 ms 2656 KB Output isn't correct
6 Incorrect 3 ms 2772 KB Output isn't correct
7 Incorrect 3 ms 2924 KB Output isn't correct
8 Incorrect 2 ms 2924 KB Output isn't correct
9 Incorrect 10 ms 3172 KB Output isn't correct
10 Correct 10 ms 3668 KB Output is correct
11 Incorrect 6 ms 4012 KB Output isn't correct
12 Incorrect 0 ms 4020 KB Output isn't correct
13 Incorrect 3 ms 4032 KB Output isn't correct
14 Incorrect 3 ms 4052 KB Output isn't correct
15 Incorrect 7 ms 4328 KB Output isn't correct
16 Correct 13 ms 4992 KB Output is correct
17 Incorrect 2 ms 5056 KB Output isn't correct
18 Incorrect 15 ms 5716 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 6440 KB Output isn't correct
2 Incorrect 13 ms 6960 KB Output isn't correct
3 Incorrect 19 ms 7752 KB Output isn't correct
4 Incorrect 22 ms 8596 KB Output isn't correct
5 Incorrect 34 ms 10104 KB Output isn't correct
6 Incorrect 23 ms 10864 KB Output isn't correct
7 Incorrect 25 ms 11900 KB Output isn't correct
8 Incorrect 16 ms 12552 KB Output isn't correct
9 Incorrect 16 ms 13204 KB Output isn't correct
10 Incorrect 6 ms 13368 KB Output isn't correct
11 Incorrect 8 ms 13476 KB Output isn't correct
12 Incorrect 8 ms 13800 KB Output isn't correct
13 Incorrect 24 ms 14772 KB Output isn't correct
14 Incorrect 22 ms 15556 KB Output isn't correct
15 Incorrect 8 ms 15660 KB Output isn't correct
16 Incorrect 8 ms 15884 KB Output isn't correct
17 Incorrect 10 ms 16220 KB Output isn't correct
18 Incorrect 12 ms 16816 KB Output isn't correct
19 Incorrect 7 ms 16892 KB Output isn't correct
20 Incorrect 19 ms 17732 KB Output isn't correct
21 Incorrect 22 ms 18636 KB Output isn't correct
22 Incorrect 38 ms 20220 KB Output isn't correct
23 Incorrect 26 ms 21180 KB Output isn't correct
24 Incorrect 22 ms 21908 KB Output isn't correct
25 Incorrect 23 ms 22644 KB Output isn't correct
26 Incorrect 21 ms 23256 KB Output isn't correct
27 Incorrect 25 ms 24336 KB Output isn't correct
28 Incorrect 22 ms 25204 KB Output isn't correct
29 Incorrect 33 ms 26760 KB Output isn't correct
30 Incorrect 29 ms 28088 KB Output isn't correct
31 Incorrect 20 ms 28704 KB Output isn't correct
32 Incorrect 21 ms 29444 KB Output isn't correct
33 Incorrect 20 ms 30056 KB Output isn't correct
34 Incorrect 24 ms 31136 KB Output isn't correct
35 Incorrect 22 ms 32040 KB Output isn't correct
36 Incorrect 33 ms 33604 KB Output isn't correct
37 Incorrect 33 ms 35028 KB Output isn't correct
38 Incorrect 22 ms 35792 KB Output isn't correct
39 Incorrect 22 ms 36552 KB Output isn't correct
40 Incorrect 22 ms 37332 KB Output isn't correct
41 Correct 24 ms 38480 KB Output is correct
42 Incorrect 22 ms 39268 KB Output isn't correct