답안 #313958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313958 2020-10-17T15:26:10 Z shivensinha4 Brunhilda’s Birthday (BOI13_brunhilda) C++17
0 / 100
46 ms 10748 KB
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl '\n'

const int MXV = 10;
vi facs[MXV+2];
int ans[MXV+2], curVal[MXV+2];


int main() {
	#ifdef shiven
	freopen("test.in", "r", stdin);
	#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, q; cin >> n >> q;
	vi primes(n);
	for_(i, 0, n) cin >> primes[i];
	for (int i: primes) for (int j = i; j <= MXV; j += i) facs[j].push_back(i);
	
	set<ii> vals;
	for (int i: primes) vals.insert({0, i});
	
	for_(i, 1, MXV+1) {
		//cout << i << ":: ";
		for (auto p: facs[i]) if (vals.count({curVal[p], p})) vals.erase({curVal[p], p});
		
		//for (ii c: vals) cout << c.first << " " << c.second << endl;
		//cout << endl;
		
		if (vals.size()) ans[i] = (*vals.begin()).first+1;
		else ans[i] = -1;
		
		if (ans[i] != -1) for (auto p: facs[i]) vals.insert({curVal[p] = ans[i], p});
		//cout << i << ": " << ans[i] << endl;
	}
	
	for_(x, 0, q) {
		int k; cin >> k;
		if (ans[k] == -1) cout << "oo";
		else cout << ans[k];
		cout << endl;
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 0 ms 384 KB Output isn't correct
6 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Incorrect 0 ms 384 KB Output isn't correct
10 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Incorrect 0 ms 384 KB Output isn't correct
13 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1664 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 34 ms 9848 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Incorrect 22 ms 3840 KB Output isn't correct
4 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 19 ms 5760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 1664 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 27 ms 7928 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Incorrect 22 ms 3968 KB Output isn't correct
11 Runtime error 14 ms 4608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 16 ms 4864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 33 ms 9856 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 36 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 19 ms 5632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 19 ms 5888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 18 ms 5632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 36 ms 10616 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 36 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 18 ms 5632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 19 ms 5632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 11 ms 3584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 2 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 18 ms 5112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 20 ms 5880 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 2 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 18 ms 5632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 37 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 11 ms 3712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 37 ms 10748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 35 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 27 ms 7680 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 2 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 37 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 33 ms 9724 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 37 ms 10616 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 4 ms 1408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 46 ms 10744 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)