답안 #393231

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
393231 2021-04-23T02:09:32 Z nikatamliani Toys (CEOI18_toy) C++14
79 / 100
5000 ms 75228 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
using namespace std;
const int N = 1e5+10;
unordered_set<int> dp[N];
int n;
vector<int> ds;
map<int, int> id;
void relax(int x) {
    int me = id[x];
	for(int i = 0; i < (int)ds.size(); ++i) {
		if(n % ((long long)ds[i] * x) == 0) {
		    int he = id[ds[i] * x];
			for(int p : dp[i]) {
				for(int q : dp[me]) {
					dp[he].insert(p + q);
				}
			}
		}
	}
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 1; i * i <= n; ++i) {
		if(n % i == 0) {
			ds.push_back(i);
			if(i * i < n) ds.push_back(n / i);
		}
	}
	sort(ds.begin(), ds.end());
	for(int i = 0; i < (int)ds.size(); ++i) {
	    id[ds[i]] = i;
	    dp[i].insert(ds[i] - 1);
	}
	for(int x : ds) {
	    relax(x);
	}
	int s = (int)ds.size() - 1;
	vector<int> answers(dp[s].begin(), dp[s].end());
	sort(answers.begin(), answers.end());
	cout << (int)answers.size() << '\n';
	for(int x : answers) cout << x << ' ';
}

Compilation message

toy.cpp:4: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("unroll-loops")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5708 KB Output is correct
2 Correct 4 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 4 ms 5776 KB Output is correct
5 Correct 4 ms 5708 KB Output is correct
6 Correct 4 ms 5708 KB Output is correct
7 Correct 5 ms 5708 KB Output is correct
8 Correct 4 ms 5708 KB Output is correct
9 Correct 4 ms 5708 KB Output is correct
10 Correct 4 ms 5800 KB Output is correct
11 Correct 4 ms 5804 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 4 ms 5708 KB Output is correct
14 Correct 4 ms 5708 KB Output is correct
15 Correct 4 ms 5708 KB Output is correct
16 Correct 4 ms 5796 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5800 KB Output is correct
20 Correct 4 ms 5804 KB Output is correct
21 Correct 5 ms 5708 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
23 Correct 4 ms 5708 KB Output is correct
24 Correct 4 ms 5796 KB Output is correct
25 Correct 4 ms 5708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5708 KB Output is correct
2 Correct 4 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 4 ms 5776 KB Output is correct
5 Correct 4 ms 5708 KB Output is correct
6 Correct 4 ms 5708 KB Output is correct
7 Correct 5 ms 5708 KB Output is correct
8 Correct 4 ms 5708 KB Output is correct
9 Correct 4 ms 5708 KB Output is correct
10 Correct 4 ms 5800 KB Output is correct
11 Correct 4 ms 5804 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 4 ms 5708 KB Output is correct
14 Correct 4 ms 5708 KB Output is correct
15 Correct 4 ms 5708 KB Output is correct
16 Correct 4 ms 5796 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5800 KB Output is correct
20 Correct 4 ms 5804 KB Output is correct
21 Correct 5 ms 5708 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
23 Correct 4 ms 5708 KB Output is correct
24 Correct 4 ms 5796 KB Output is correct
25 Correct 4 ms 5708 KB Output is correct
26 Correct 4 ms 5796 KB Output is correct
27 Correct 4 ms 5836 KB Output is correct
28 Correct 5 ms 5708 KB Output is correct
29 Correct 4 ms 5708 KB Output is correct
30 Correct 5 ms 5740 KB Output is correct
31 Correct 5 ms 5836 KB Output is correct
32 Correct 4 ms 5836 KB Output is correct
33 Correct 5 ms 5836 KB Output is correct
34 Correct 4 ms 5708 KB Output is correct
35 Correct 4 ms 5708 KB Output is correct
36 Correct 4 ms 5744 KB Output is correct
37 Correct 4 ms 5836 KB Output is correct
38 Correct 4 ms 5708 KB Output is correct
39 Correct 4 ms 5708 KB Output is correct
40 Correct 4 ms 5796 KB Output is correct
41 Correct 4 ms 5708 KB Output is correct
42 Correct 4 ms 5708 KB Output is correct
43 Correct 4 ms 5800 KB Output is correct
44 Correct 4 ms 5708 KB Output is correct
45 Correct 4 ms 5708 KB Output is correct
46 Correct 4 ms 5708 KB Output is correct
47 Correct 4 ms 5836 KB Output is correct
48 Correct 4 ms 5696 KB Output is correct
49 Correct 4 ms 5708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5708 KB Output is correct
2 Correct 4 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 4 ms 5776 KB Output is correct
5 Correct 4 ms 5708 KB Output is correct
6 Correct 4 ms 5708 KB Output is correct
7 Correct 5 ms 5708 KB Output is correct
8 Correct 4 ms 5708 KB Output is correct
9 Correct 4 ms 5708 KB Output is correct
10 Correct 4 ms 5800 KB Output is correct
11 Correct 4 ms 5804 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 4 ms 5708 KB Output is correct
14 Correct 4 ms 5708 KB Output is correct
15 Correct 4 ms 5708 KB Output is correct
16 Correct 4 ms 5796 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5800 KB Output is correct
20 Correct 4 ms 5804 KB Output is correct
21 Correct 5 ms 5708 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
23 Correct 4 ms 5708 KB Output is correct
24 Correct 4 ms 5796 KB Output is correct
25 Correct 4 ms 5708 KB Output is correct
26 Correct 4 ms 5796 KB Output is correct
27 Correct 4 ms 5836 KB Output is correct
28 Correct 5 ms 5708 KB Output is correct
29 Correct 4 ms 5708 KB Output is correct
30 Correct 5 ms 5740 KB Output is correct
31 Correct 5 ms 5836 KB Output is correct
32 Correct 4 ms 5836 KB Output is correct
33 Correct 5 ms 5836 KB Output is correct
34 Correct 4 ms 5708 KB Output is correct
35 Correct 4 ms 5708 KB Output is correct
36 Correct 4 ms 5744 KB Output is correct
37 Correct 4 ms 5836 KB Output is correct
38 Correct 4 ms 5708 KB Output is correct
39 Correct 4 ms 5708 KB Output is correct
40 Correct 4 ms 5796 KB Output is correct
41 Correct 4 ms 5708 KB Output is correct
42 Correct 4 ms 5708 KB Output is correct
43 Correct 4 ms 5800 KB Output is correct
44 Correct 4 ms 5708 KB Output is correct
45 Correct 4 ms 5708 KB Output is correct
46 Correct 4 ms 5708 KB Output is correct
47 Correct 4 ms 5836 KB Output is correct
48 Correct 4 ms 5696 KB Output is correct
49 Correct 4 ms 5708 KB Output is correct
50 Correct 7 ms 5964 KB Output is correct
51 Correct 6 ms 5964 KB Output is correct
52 Correct 7 ms 5964 KB Output is correct
53 Correct 7 ms 5964 KB Output is correct
54 Correct 5 ms 5836 KB Output is correct
55 Correct 9 ms 6092 KB Output is correct
56 Correct 9 ms 6092 KB Output is correct
57 Correct 8 ms 6092 KB Output is correct
58 Correct 4 ms 5708 KB Output is correct
59 Correct 4 ms 5708 KB Output is correct
60 Correct 4 ms 5836 KB Output is correct
61 Correct 6 ms 5928 KB Output is correct
62 Correct 6 ms 5836 KB Output is correct
63 Correct 4 ms 5796 KB Output is correct
64 Correct 5 ms 5708 KB Output is correct
65 Correct 7 ms 5964 KB Output is correct
66 Correct 4 ms 5708 KB Output is correct
67 Correct 4 ms 5708 KB Output is correct
68 Correct 4 ms 5708 KB Output is correct
69 Correct 4 ms 5708 KB Output is correct
70 Correct 5 ms 5836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5708 KB Output is correct
2 Correct 4 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 4 ms 5776 KB Output is correct
5 Correct 4 ms 5708 KB Output is correct
6 Correct 4 ms 5708 KB Output is correct
7 Correct 5 ms 5708 KB Output is correct
8 Correct 4 ms 5708 KB Output is correct
9 Correct 4 ms 5708 KB Output is correct
10 Correct 4 ms 5800 KB Output is correct
11 Correct 4 ms 5804 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 4 ms 5708 KB Output is correct
14 Correct 4 ms 5708 KB Output is correct
15 Correct 4 ms 5708 KB Output is correct
16 Correct 4 ms 5796 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5800 KB Output is correct
20 Correct 4 ms 5804 KB Output is correct
21 Correct 5 ms 5708 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
23 Correct 4 ms 5708 KB Output is correct
24 Correct 4 ms 5796 KB Output is correct
25 Correct 4 ms 5708 KB Output is correct
26 Correct 4 ms 5796 KB Output is correct
27 Correct 4 ms 5836 KB Output is correct
28 Correct 5 ms 5708 KB Output is correct
29 Correct 4 ms 5708 KB Output is correct
30 Correct 5 ms 5740 KB Output is correct
31 Correct 5 ms 5836 KB Output is correct
32 Correct 4 ms 5836 KB Output is correct
33 Correct 5 ms 5836 KB Output is correct
34 Correct 4 ms 5708 KB Output is correct
35 Correct 4 ms 5708 KB Output is correct
36 Correct 4 ms 5744 KB Output is correct
37 Correct 4 ms 5836 KB Output is correct
38 Correct 4 ms 5708 KB Output is correct
39 Correct 4 ms 5708 KB Output is correct
40 Correct 4 ms 5796 KB Output is correct
41 Correct 4 ms 5708 KB Output is correct
42 Correct 4 ms 5708 KB Output is correct
43 Correct 4 ms 5800 KB Output is correct
44 Correct 4 ms 5708 KB Output is correct
45 Correct 4 ms 5708 KB Output is correct
46 Correct 4 ms 5708 KB Output is correct
47 Correct 4 ms 5836 KB Output is correct
48 Correct 4 ms 5696 KB Output is correct
49 Correct 4 ms 5708 KB Output is correct
50 Correct 7 ms 5964 KB Output is correct
51 Correct 6 ms 5964 KB Output is correct
52 Correct 7 ms 5964 KB Output is correct
53 Correct 7 ms 5964 KB Output is correct
54 Correct 5 ms 5836 KB Output is correct
55 Correct 9 ms 6092 KB Output is correct
56 Correct 9 ms 6092 KB Output is correct
57 Correct 8 ms 6092 KB Output is correct
58 Correct 4 ms 5708 KB Output is correct
59 Correct 4 ms 5708 KB Output is correct
60 Correct 4 ms 5836 KB Output is correct
61 Correct 6 ms 5928 KB Output is correct
62 Correct 6 ms 5836 KB Output is correct
63 Correct 4 ms 5796 KB Output is correct
64 Correct 5 ms 5708 KB Output is correct
65 Correct 7 ms 5964 KB Output is correct
66 Correct 4 ms 5708 KB Output is correct
67 Correct 4 ms 5708 KB Output is correct
68 Correct 4 ms 5708 KB Output is correct
69 Correct 4 ms 5708 KB Output is correct
70 Correct 5 ms 5836 KB Output is correct
71 Correct 1506 ms 22348 KB Output is correct
72 Correct 822 ms 18452 KB Output is correct
73 Correct 1434 ms 20856 KB Output is correct
74 Correct 484 ms 15616 KB Output is correct
75 Correct 698 ms 16432 KB Output is correct
76 Correct 2998 ms 28220 KB Output is correct
77 Correct 2916 ms 25760 KB Output is correct
78 Correct 2120 ms 24360 KB Output is correct
79 Correct 2095 ms 24004 KB Output is correct
80 Correct 4 ms 5708 KB Output is correct
81 Correct 4 ms 5708 KB Output is correct
82 Correct 11 ms 6116 KB Output is correct
83 Correct 170 ms 8768 KB Output is correct
84 Correct 166 ms 9540 KB Output is correct
85 Correct 28 ms 6860 KB Output is correct
86 Correct 4 ms 5804 KB Output is correct
87 Correct 183 ms 10124 KB Output is correct
88 Correct 4 ms 5708 KB Output is correct
89 Correct 4 ms 5800 KB Output is correct
90 Correct 4 ms 5708 KB Output is correct
91 Correct 28 ms 7364 KB Output is correct
92 Correct 161 ms 11400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5708 KB Output is correct
2 Correct 4 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 4 ms 5776 KB Output is correct
5 Correct 4 ms 5708 KB Output is correct
6 Correct 4 ms 5708 KB Output is correct
7 Correct 5 ms 5708 KB Output is correct
8 Correct 4 ms 5708 KB Output is correct
9 Correct 4 ms 5708 KB Output is correct
10 Correct 4 ms 5800 KB Output is correct
11 Correct 4 ms 5804 KB Output is correct
12 Correct 4 ms 5708 KB Output is correct
13 Correct 4 ms 5708 KB Output is correct
14 Correct 4 ms 5708 KB Output is correct
15 Correct 4 ms 5708 KB Output is correct
16 Correct 4 ms 5796 KB Output is correct
17 Correct 4 ms 5708 KB Output is correct
18 Correct 4 ms 5708 KB Output is correct
19 Correct 4 ms 5800 KB Output is correct
20 Correct 4 ms 5804 KB Output is correct
21 Correct 5 ms 5708 KB Output is correct
22 Correct 4 ms 5708 KB Output is correct
23 Correct 4 ms 5708 KB Output is correct
24 Correct 4 ms 5796 KB Output is correct
25 Correct 4 ms 5708 KB Output is correct
26 Correct 4 ms 5796 KB Output is correct
27 Correct 4 ms 5836 KB Output is correct
28 Correct 5 ms 5708 KB Output is correct
29 Correct 4 ms 5708 KB Output is correct
30 Correct 5 ms 5740 KB Output is correct
31 Correct 5 ms 5836 KB Output is correct
32 Correct 4 ms 5836 KB Output is correct
33 Correct 5 ms 5836 KB Output is correct
34 Correct 4 ms 5708 KB Output is correct
35 Correct 4 ms 5708 KB Output is correct
36 Correct 4 ms 5744 KB Output is correct
37 Correct 4 ms 5836 KB Output is correct
38 Correct 4 ms 5708 KB Output is correct
39 Correct 4 ms 5708 KB Output is correct
40 Correct 4 ms 5796 KB Output is correct
41 Correct 4 ms 5708 KB Output is correct
42 Correct 4 ms 5708 KB Output is correct
43 Correct 4 ms 5800 KB Output is correct
44 Correct 4 ms 5708 KB Output is correct
45 Correct 4 ms 5708 KB Output is correct
46 Correct 4 ms 5708 KB Output is correct
47 Correct 4 ms 5836 KB Output is correct
48 Correct 4 ms 5696 KB Output is correct
49 Correct 4 ms 5708 KB Output is correct
50 Correct 7 ms 5964 KB Output is correct
51 Correct 6 ms 5964 KB Output is correct
52 Correct 7 ms 5964 KB Output is correct
53 Correct 7 ms 5964 KB Output is correct
54 Correct 5 ms 5836 KB Output is correct
55 Correct 9 ms 6092 KB Output is correct
56 Correct 9 ms 6092 KB Output is correct
57 Correct 8 ms 6092 KB Output is correct
58 Correct 4 ms 5708 KB Output is correct
59 Correct 4 ms 5708 KB Output is correct
60 Correct 4 ms 5836 KB Output is correct
61 Correct 6 ms 5928 KB Output is correct
62 Correct 6 ms 5836 KB Output is correct
63 Correct 4 ms 5796 KB Output is correct
64 Correct 5 ms 5708 KB Output is correct
65 Correct 7 ms 5964 KB Output is correct
66 Correct 4 ms 5708 KB Output is correct
67 Correct 4 ms 5708 KB Output is correct
68 Correct 4 ms 5708 KB Output is correct
69 Correct 4 ms 5708 KB Output is correct
70 Correct 5 ms 5836 KB Output is correct
71 Correct 1506 ms 22348 KB Output is correct
72 Correct 822 ms 18452 KB Output is correct
73 Correct 1434 ms 20856 KB Output is correct
74 Correct 484 ms 15616 KB Output is correct
75 Correct 698 ms 16432 KB Output is correct
76 Correct 2998 ms 28220 KB Output is correct
77 Correct 2916 ms 25760 KB Output is correct
78 Correct 2120 ms 24360 KB Output is correct
79 Correct 2095 ms 24004 KB Output is correct
80 Correct 4 ms 5708 KB Output is correct
81 Correct 4 ms 5708 KB Output is correct
82 Correct 11 ms 6116 KB Output is correct
83 Correct 170 ms 8768 KB Output is correct
84 Correct 166 ms 9540 KB Output is correct
85 Correct 28 ms 6860 KB Output is correct
86 Correct 4 ms 5804 KB Output is correct
87 Correct 183 ms 10124 KB Output is correct
88 Correct 4 ms 5708 KB Output is correct
89 Correct 4 ms 5800 KB Output is correct
90 Correct 4 ms 5708 KB Output is correct
91 Correct 28 ms 7364 KB Output is correct
92 Correct 161 ms 11400 KB Output is correct
93 Execution timed out 5056 ms 75228 KB Time limit exceeded
94 Halted 0 ms 0 KB -