Submission #78896

# Submission time Handle Problem Language Result Execution time Memory
78896 2018-10-09T13:55:54 Z aminra Toys (CEOI18_toy) C++14
79 / 100
5000 ms 47288 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
vector<int> dv;
set<int> dp[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i * i <= n; i++)
	{
		dv.push_back(i);
		if(i * i != n)
			dv.push_back(n / i);
	}
	sort(dv.begin(), dv.end());
	dp[0].insert(0);
	for (int i = 1; i < dv.size(); i++)
		for (int j = 0; j < i; j++)
			if(dv[i] % dv[j] == 0)
				for (auto u : dp[j])
					dp[i].insert(u + dv[i] / dv[j] - 1);
	cout << dp[dv.size() - 1].size() << "\n";
	for (auto u : dp[dv.size() - 1])
		cout << u << " ";
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:24:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < dv.size(); i++)
                  ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5108 KB Output is correct
3 Correct 6 ms 5184 KB Output is correct
4 Correct 6 ms 5260 KB Output is correct
5 Correct 6 ms 5260 KB Output is correct
6 Correct 5 ms 5260 KB Output is correct
7 Correct 6 ms 5260 KB Output is correct
8 Correct 6 ms 5260 KB Output is correct
9 Correct 6 ms 5260 KB Output is correct
10 Correct 6 ms 5260 KB Output is correct
11 Correct 6 ms 5260 KB Output is correct
12 Correct 6 ms 5260 KB Output is correct
13 Correct 6 ms 5260 KB Output is correct
14 Correct 6 ms 5260 KB Output is correct
15 Correct 6 ms 5260 KB Output is correct
16 Correct 5 ms 5260 KB Output is correct
17 Correct 6 ms 5260 KB Output is correct
18 Correct 6 ms 5260 KB Output is correct
19 Correct 6 ms 5260 KB Output is correct
20 Correct 6 ms 5260 KB Output is correct
21 Correct 6 ms 5272 KB Output is correct
22 Correct 5 ms 5272 KB Output is correct
23 Correct 5 ms 5272 KB Output is correct
24 Correct 5 ms 5272 KB Output is correct
25 Correct 6 ms 5272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5108 KB Output is correct
3 Correct 6 ms 5184 KB Output is correct
4 Correct 6 ms 5260 KB Output is correct
5 Correct 6 ms 5260 KB Output is correct
6 Correct 5 ms 5260 KB Output is correct
7 Correct 6 ms 5260 KB Output is correct
8 Correct 6 ms 5260 KB Output is correct
9 Correct 6 ms 5260 KB Output is correct
10 Correct 6 ms 5260 KB Output is correct
11 Correct 6 ms 5260 KB Output is correct
12 Correct 6 ms 5260 KB Output is correct
13 Correct 6 ms 5260 KB Output is correct
14 Correct 6 ms 5260 KB Output is correct
15 Correct 6 ms 5260 KB Output is correct
16 Correct 5 ms 5260 KB Output is correct
17 Correct 6 ms 5260 KB Output is correct
18 Correct 6 ms 5260 KB Output is correct
19 Correct 6 ms 5260 KB Output is correct
20 Correct 6 ms 5260 KB Output is correct
21 Correct 6 ms 5272 KB Output is correct
22 Correct 5 ms 5272 KB Output is correct
23 Correct 5 ms 5272 KB Output is correct
24 Correct 5 ms 5272 KB Output is correct
25 Correct 6 ms 5272 KB Output is correct
26 Correct 6 ms 5372 KB Output is correct
27 Correct 7 ms 5372 KB Output is correct
28 Correct 6 ms 5376 KB Output is correct
29 Correct 5 ms 5376 KB Output is correct
30 Correct 6 ms 5376 KB Output is correct
31 Correct 6 ms 5376 KB Output is correct
32 Correct 6 ms 5376 KB Output is correct
33 Correct 6 ms 5376 KB Output is correct
34 Correct 6 ms 5376 KB Output is correct
35 Correct 6 ms 5376 KB Output is correct
36 Correct 8 ms 5376 KB Output is correct
37 Correct 6 ms 5376 KB Output is correct
38 Correct 6 ms 5376 KB Output is correct
39 Correct 6 ms 5376 KB Output is correct
40 Correct 7 ms 5376 KB Output is correct
41 Correct 6 ms 5376 KB Output is correct
42 Correct 6 ms 5376 KB Output is correct
43 Correct 6 ms 5376 KB Output is correct
44 Correct 6 ms 5376 KB Output is correct
45 Correct 8 ms 5376 KB Output is correct
46 Correct 6 ms 5376 KB Output is correct
47 Correct 6 ms 5376 KB Output is correct
48 Correct 6 ms 5376 KB Output is correct
49 Correct 6 ms 5376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5108 KB Output is correct
3 Correct 6 ms 5184 KB Output is correct
4 Correct 6 ms 5260 KB Output is correct
5 Correct 6 ms 5260 KB Output is correct
6 Correct 5 ms 5260 KB Output is correct
7 Correct 6 ms 5260 KB Output is correct
8 Correct 6 ms 5260 KB Output is correct
9 Correct 6 ms 5260 KB Output is correct
10 Correct 6 ms 5260 KB Output is correct
11 Correct 6 ms 5260 KB Output is correct
12 Correct 6 ms 5260 KB Output is correct
13 Correct 6 ms 5260 KB Output is correct
14 Correct 6 ms 5260 KB Output is correct
15 Correct 6 ms 5260 KB Output is correct
16 Correct 5 ms 5260 KB Output is correct
17 Correct 6 ms 5260 KB Output is correct
18 Correct 6 ms 5260 KB Output is correct
19 Correct 6 ms 5260 KB Output is correct
20 Correct 6 ms 5260 KB Output is correct
21 Correct 6 ms 5272 KB Output is correct
22 Correct 5 ms 5272 KB Output is correct
23 Correct 5 ms 5272 KB Output is correct
24 Correct 5 ms 5272 KB Output is correct
25 Correct 6 ms 5272 KB Output is correct
26 Correct 6 ms 5372 KB Output is correct
27 Correct 7 ms 5372 KB Output is correct
28 Correct 6 ms 5376 KB Output is correct
29 Correct 5 ms 5376 KB Output is correct
30 Correct 6 ms 5376 KB Output is correct
31 Correct 6 ms 5376 KB Output is correct
32 Correct 6 ms 5376 KB Output is correct
33 Correct 6 ms 5376 KB Output is correct
34 Correct 6 ms 5376 KB Output is correct
35 Correct 6 ms 5376 KB Output is correct
36 Correct 8 ms 5376 KB Output is correct
37 Correct 6 ms 5376 KB Output is correct
38 Correct 6 ms 5376 KB Output is correct
39 Correct 6 ms 5376 KB Output is correct
40 Correct 7 ms 5376 KB Output is correct
41 Correct 6 ms 5376 KB Output is correct
42 Correct 6 ms 5376 KB Output is correct
43 Correct 6 ms 5376 KB Output is correct
44 Correct 6 ms 5376 KB Output is correct
45 Correct 8 ms 5376 KB Output is correct
46 Correct 6 ms 5376 KB Output is correct
47 Correct 6 ms 5376 KB Output is correct
48 Correct 6 ms 5376 KB Output is correct
49 Correct 6 ms 5376 KB Output is correct
50 Correct 10 ms 5628 KB Output is correct
51 Correct 8 ms 5628 KB Output is correct
52 Correct 9 ms 5628 KB Output is correct
53 Correct 9 ms 5628 KB Output is correct
54 Correct 7 ms 5628 KB Output is correct
55 Correct 14 ms 5760 KB Output is correct
56 Correct 11 ms 5760 KB Output is correct
57 Correct 11 ms 5760 KB Output is correct
58 Correct 8 ms 5760 KB Output is correct
59 Correct 9 ms 5760 KB Output is correct
60 Correct 10 ms 5760 KB Output is correct
61 Correct 9 ms 5760 KB Output is correct
62 Correct 7 ms 5760 KB Output is correct
63 Correct 8 ms 5760 KB Output is correct
64 Correct 7 ms 5760 KB Output is correct
65 Correct 10 ms 5760 KB Output is correct
66 Correct 8 ms 5760 KB Output is correct
67 Correct 8 ms 5760 KB Output is correct
68 Correct 8 ms 5760 KB Output is correct
69 Correct 7 ms 5760 KB Output is correct
70 Correct 9 ms 5760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5108 KB Output is correct
3 Correct 6 ms 5184 KB Output is correct
4 Correct 6 ms 5260 KB Output is correct
5 Correct 6 ms 5260 KB Output is correct
6 Correct 5 ms 5260 KB Output is correct
7 Correct 6 ms 5260 KB Output is correct
8 Correct 6 ms 5260 KB Output is correct
9 Correct 6 ms 5260 KB Output is correct
10 Correct 6 ms 5260 KB Output is correct
11 Correct 6 ms 5260 KB Output is correct
12 Correct 6 ms 5260 KB Output is correct
13 Correct 6 ms 5260 KB Output is correct
14 Correct 6 ms 5260 KB Output is correct
15 Correct 6 ms 5260 KB Output is correct
16 Correct 5 ms 5260 KB Output is correct
17 Correct 6 ms 5260 KB Output is correct
18 Correct 6 ms 5260 KB Output is correct
19 Correct 6 ms 5260 KB Output is correct
20 Correct 6 ms 5260 KB Output is correct
21 Correct 6 ms 5272 KB Output is correct
22 Correct 5 ms 5272 KB Output is correct
23 Correct 5 ms 5272 KB Output is correct
24 Correct 5 ms 5272 KB Output is correct
25 Correct 6 ms 5272 KB Output is correct
26 Correct 6 ms 5372 KB Output is correct
27 Correct 7 ms 5372 KB Output is correct
28 Correct 6 ms 5376 KB Output is correct
29 Correct 5 ms 5376 KB Output is correct
30 Correct 6 ms 5376 KB Output is correct
31 Correct 6 ms 5376 KB Output is correct
32 Correct 6 ms 5376 KB Output is correct
33 Correct 6 ms 5376 KB Output is correct
34 Correct 6 ms 5376 KB Output is correct
35 Correct 6 ms 5376 KB Output is correct
36 Correct 8 ms 5376 KB Output is correct
37 Correct 6 ms 5376 KB Output is correct
38 Correct 6 ms 5376 KB Output is correct
39 Correct 6 ms 5376 KB Output is correct
40 Correct 7 ms 5376 KB Output is correct
41 Correct 6 ms 5376 KB Output is correct
42 Correct 6 ms 5376 KB Output is correct
43 Correct 6 ms 5376 KB Output is correct
44 Correct 6 ms 5376 KB Output is correct
45 Correct 8 ms 5376 KB Output is correct
46 Correct 6 ms 5376 KB Output is correct
47 Correct 6 ms 5376 KB Output is correct
48 Correct 6 ms 5376 KB Output is correct
49 Correct 6 ms 5376 KB Output is correct
50 Correct 10 ms 5628 KB Output is correct
51 Correct 8 ms 5628 KB Output is correct
52 Correct 9 ms 5628 KB Output is correct
53 Correct 9 ms 5628 KB Output is correct
54 Correct 7 ms 5628 KB Output is correct
55 Correct 14 ms 5760 KB Output is correct
56 Correct 11 ms 5760 KB Output is correct
57 Correct 11 ms 5760 KB Output is correct
58 Correct 8 ms 5760 KB Output is correct
59 Correct 9 ms 5760 KB Output is correct
60 Correct 10 ms 5760 KB Output is correct
61 Correct 9 ms 5760 KB Output is correct
62 Correct 7 ms 5760 KB Output is correct
63 Correct 8 ms 5760 KB Output is correct
64 Correct 7 ms 5760 KB Output is correct
65 Correct 10 ms 5760 KB Output is correct
66 Correct 8 ms 5760 KB Output is correct
67 Correct 8 ms 5760 KB Output is correct
68 Correct 8 ms 5760 KB Output is correct
69 Correct 7 ms 5760 KB Output is correct
70 Correct 9 ms 5760 KB Output is correct
71 Correct 1182 ms 33784 KB Output is correct
72 Correct 922 ms 33784 KB Output is correct
73 Correct 897 ms 33784 KB Output is correct
74 Correct 649 ms 33784 KB Output is correct
75 Correct 612 ms 33784 KB Output is correct
76 Correct 1559 ms 41152 KB Output is correct
77 Correct 1459 ms 41152 KB Output is correct
78 Correct 1339 ms 41152 KB Output is correct
79 Correct 1242 ms 41152 KB Output is correct
80 Correct 1020 ms 41152 KB Output is correct
81 Correct 934 ms 41152 KB Output is correct
82 Correct 702 ms 41152 KB Output is correct
83 Correct 687 ms 41152 KB Output is correct
84 Correct 341 ms 41152 KB Output is correct
85 Correct 1022 ms 41152 KB Output is correct
86 Correct 1025 ms 41152 KB Output is correct
87 Correct 960 ms 41152 KB Output is correct
88 Correct 1010 ms 41152 KB Output is correct
89 Correct 1024 ms 41152 KB Output is correct
90 Correct 1043 ms 41152 KB Output is correct
91 Correct 1040 ms 41152 KB Output is correct
92 Correct 1043 ms 41152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 5108 KB Output is correct
3 Correct 6 ms 5184 KB Output is correct
4 Correct 6 ms 5260 KB Output is correct
5 Correct 6 ms 5260 KB Output is correct
6 Correct 5 ms 5260 KB Output is correct
7 Correct 6 ms 5260 KB Output is correct
8 Correct 6 ms 5260 KB Output is correct
9 Correct 6 ms 5260 KB Output is correct
10 Correct 6 ms 5260 KB Output is correct
11 Correct 6 ms 5260 KB Output is correct
12 Correct 6 ms 5260 KB Output is correct
13 Correct 6 ms 5260 KB Output is correct
14 Correct 6 ms 5260 KB Output is correct
15 Correct 6 ms 5260 KB Output is correct
16 Correct 5 ms 5260 KB Output is correct
17 Correct 6 ms 5260 KB Output is correct
18 Correct 6 ms 5260 KB Output is correct
19 Correct 6 ms 5260 KB Output is correct
20 Correct 6 ms 5260 KB Output is correct
21 Correct 6 ms 5272 KB Output is correct
22 Correct 5 ms 5272 KB Output is correct
23 Correct 5 ms 5272 KB Output is correct
24 Correct 5 ms 5272 KB Output is correct
25 Correct 6 ms 5272 KB Output is correct
26 Correct 6 ms 5372 KB Output is correct
27 Correct 7 ms 5372 KB Output is correct
28 Correct 6 ms 5376 KB Output is correct
29 Correct 5 ms 5376 KB Output is correct
30 Correct 6 ms 5376 KB Output is correct
31 Correct 6 ms 5376 KB Output is correct
32 Correct 6 ms 5376 KB Output is correct
33 Correct 6 ms 5376 KB Output is correct
34 Correct 6 ms 5376 KB Output is correct
35 Correct 6 ms 5376 KB Output is correct
36 Correct 8 ms 5376 KB Output is correct
37 Correct 6 ms 5376 KB Output is correct
38 Correct 6 ms 5376 KB Output is correct
39 Correct 6 ms 5376 KB Output is correct
40 Correct 7 ms 5376 KB Output is correct
41 Correct 6 ms 5376 KB Output is correct
42 Correct 6 ms 5376 KB Output is correct
43 Correct 6 ms 5376 KB Output is correct
44 Correct 6 ms 5376 KB Output is correct
45 Correct 8 ms 5376 KB Output is correct
46 Correct 6 ms 5376 KB Output is correct
47 Correct 6 ms 5376 KB Output is correct
48 Correct 6 ms 5376 KB Output is correct
49 Correct 6 ms 5376 KB Output is correct
50 Correct 10 ms 5628 KB Output is correct
51 Correct 8 ms 5628 KB Output is correct
52 Correct 9 ms 5628 KB Output is correct
53 Correct 9 ms 5628 KB Output is correct
54 Correct 7 ms 5628 KB Output is correct
55 Correct 14 ms 5760 KB Output is correct
56 Correct 11 ms 5760 KB Output is correct
57 Correct 11 ms 5760 KB Output is correct
58 Correct 8 ms 5760 KB Output is correct
59 Correct 9 ms 5760 KB Output is correct
60 Correct 10 ms 5760 KB Output is correct
61 Correct 9 ms 5760 KB Output is correct
62 Correct 7 ms 5760 KB Output is correct
63 Correct 8 ms 5760 KB Output is correct
64 Correct 7 ms 5760 KB Output is correct
65 Correct 10 ms 5760 KB Output is correct
66 Correct 8 ms 5760 KB Output is correct
67 Correct 8 ms 5760 KB Output is correct
68 Correct 8 ms 5760 KB Output is correct
69 Correct 7 ms 5760 KB Output is correct
70 Correct 9 ms 5760 KB Output is correct
71 Correct 1182 ms 33784 KB Output is correct
72 Correct 922 ms 33784 KB Output is correct
73 Correct 897 ms 33784 KB Output is correct
74 Correct 649 ms 33784 KB Output is correct
75 Correct 612 ms 33784 KB Output is correct
76 Correct 1559 ms 41152 KB Output is correct
77 Correct 1459 ms 41152 KB Output is correct
78 Correct 1339 ms 41152 KB Output is correct
79 Correct 1242 ms 41152 KB Output is correct
80 Correct 1020 ms 41152 KB Output is correct
81 Correct 934 ms 41152 KB Output is correct
82 Correct 702 ms 41152 KB Output is correct
83 Correct 687 ms 41152 KB Output is correct
84 Correct 341 ms 41152 KB Output is correct
85 Correct 1022 ms 41152 KB Output is correct
86 Correct 1025 ms 41152 KB Output is correct
87 Correct 960 ms 41152 KB Output is correct
88 Correct 1010 ms 41152 KB Output is correct
89 Correct 1024 ms 41152 KB Output is correct
90 Correct 1043 ms 41152 KB Output is correct
91 Correct 1040 ms 41152 KB Output is correct
92 Correct 1043 ms 41152 KB Output is correct
93 Execution timed out 5103 ms 47288 KB Time limit exceeded
94 Halted 0 ms 0 KB -