Submission #168829

# Submission time Handle Problem Language Result Execution time Memory
168829 2019-12-16T15:53:18 Z kostia244 Toys (CEOI18_toy) C++17
79 / 100
1538 ms 262148 KB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,sse2,sse,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC comment("/STACK:26666666")
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int mod = 1e9 + 7;
ll n;
vi divs, cans[1001000], canb[1001000];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	ll tn = n;
	for (ll d = 1; d * d <= tn; d++) {
		if (tn % d)
			continue;
		divs.pb(d);
		if (d * d != n) {
			divs.pb(n / d);
		}
	}
	sort(all(divs));
	cans[1].pb(0);
	for (auto i : divs) {
		vi &t = (i * i <= n ? cans[i] : canb[n / i]);
		sort(all(t));
		t.erase(unique(all(t)), t.end());
		for (auto j : divs) {
			if(j==1)continue;
			if (i * j > n)
				break;
			if (n % (i * j))
				continue;
			ll _nxt = i * j;
			vi &nxt = (_nxt * _nxt <= n ? cans[_nxt] : canb[n / _nxt]);
			for (auto q : t) {
				nxt.pb(q + j - 1);
			}
		}
	}
	vi &t = (n * n <= n ? cans[n] : canb[n / n]);
	sort(all(t));
	cout << t.size() << "\n";
	for (auto i : t)
		cout << i << " ";
}

Compilation message

toy.cpp:4:0: warning: ignoring #pragma GCC comment [-Wunknown-pragmas]
 #pragma GCC comment("/STACK:26666666")
# Verdict Execution time Memory Grader output
1 Correct 48 ms 47480 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 48 ms 47404 KB Output is correct
4 Correct 47 ms 47224 KB Output is correct
5 Correct 48 ms 47352 KB Output is correct
6 Correct 48 ms 47352 KB Output is correct
7 Correct 48 ms 47356 KB Output is correct
8 Correct 49 ms 47352 KB Output is correct
9 Correct 48 ms 47352 KB Output is correct
10 Correct 48 ms 47352 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47420 KB Output is correct
13 Correct 48 ms 47352 KB Output is correct
14 Correct 48 ms 47352 KB Output is correct
15 Correct 48 ms 47276 KB Output is correct
16 Correct 48 ms 47480 KB Output is correct
17 Correct 48 ms 47352 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47344 KB Output is correct
20 Correct 48 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 48 ms 47352 KB Output is correct
23 Correct 48 ms 47296 KB Output is correct
24 Correct 48 ms 47352 KB Output is correct
25 Correct 48 ms 47352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 47480 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 48 ms 47404 KB Output is correct
4 Correct 47 ms 47224 KB Output is correct
5 Correct 48 ms 47352 KB Output is correct
6 Correct 48 ms 47352 KB Output is correct
7 Correct 48 ms 47356 KB Output is correct
8 Correct 49 ms 47352 KB Output is correct
9 Correct 48 ms 47352 KB Output is correct
10 Correct 48 ms 47352 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47420 KB Output is correct
13 Correct 48 ms 47352 KB Output is correct
14 Correct 48 ms 47352 KB Output is correct
15 Correct 48 ms 47276 KB Output is correct
16 Correct 48 ms 47480 KB Output is correct
17 Correct 48 ms 47352 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47344 KB Output is correct
20 Correct 48 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 48 ms 47352 KB Output is correct
23 Correct 48 ms 47296 KB Output is correct
24 Correct 48 ms 47352 KB Output is correct
25 Correct 48 ms 47352 KB Output is correct
26 Correct 48 ms 47480 KB Output is correct
27 Correct 48 ms 47488 KB Output is correct
28 Correct 48 ms 47352 KB Output is correct
29 Correct 48 ms 47324 KB Output is correct
30 Correct 48 ms 47424 KB Output is correct
31 Correct 49 ms 47480 KB Output is correct
32 Correct 48 ms 47352 KB Output is correct
33 Correct 48 ms 47356 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 48 ms 47352 KB Output is correct
36 Correct 48 ms 47480 KB Output is correct
37 Correct 48 ms 47356 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47456 KB Output is correct
40 Correct 48 ms 47332 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47352 KB Output is correct
43 Correct 49 ms 47324 KB Output is correct
44 Correct 48 ms 47352 KB Output is correct
45 Correct 48 ms 47352 KB Output is correct
46 Correct 48 ms 47352 KB Output is correct
47 Correct 48 ms 47352 KB Output is correct
48 Correct 49 ms 47508 KB Output is correct
49 Correct 49 ms 47352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 47480 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 48 ms 47404 KB Output is correct
4 Correct 47 ms 47224 KB Output is correct
5 Correct 48 ms 47352 KB Output is correct
6 Correct 48 ms 47352 KB Output is correct
7 Correct 48 ms 47356 KB Output is correct
8 Correct 49 ms 47352 KB Output is correct
9 Correct 48 ms 47352 KB Output is correct
10 Correct 48 ms 47352 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47420 KB Output is correct
13 Correct 48 ms 47352 KB Output is correct
14 Correct 48 ms 47352 KB Output is correct
15 Correct 48 ms 47276 KB Output is correct
16 Correct 48 ms 47480 KB Output is correct
17 Correct 48 ms 47352 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47344 KB Output is correct
20 Correct 48 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 48 ms 47352 KB Output is correct
23 Correct 48 ms 47296 KB Output is correct
24 Correct 48 ms 47352 KB Output is correct
25 Correct 48 ms 47352 KB Output is correct
26 Correct 48 ms 47480 KB Output is correct
27 Correct 48 ms 47488 KB Output is correct
28 Correct 48 ms 47352 KB Output is correct
29 Correct 48 ms 47324 KB Output is correct
30 Correct 48 ms 47424 KB Output is correct
31 Correct 49 ms 47480 KB Output is correct
32 Correct 48 ms 47352 KB Output is correct
33 Correct 48 ms 47356 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 48 ms 47352 KB Output is correct
36 Correct 48 ms 47480 KB Output is correct
37 Correct 48 ms 47356 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47456 KB Output is correct
40 Correct 48 ms 47332 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47352 KB Output is correct
43 Correct 49 ms 47324 KB Output is correct
44 Correct 48 ms 47352 KB Output is correct
45 Correct 48 ms 47352 KB Output is correct
46 Correct 48 ms 47352 KB Output is correct
47 Correct 48 ms 47352 KB Output is correct
48 Correct 49 ms 47508 KB Output is correct
49 Correct 49 ms 47352 KB Output is correct
50 Correct 51 ms 47864 KB Output is correct
51 Correct 51 ms 47668 KB Output is correct
52 Correct 50 ms 47708 KB Output is correct
53 Correct 50 ms 47736 KB Output is correct
54 Correct 49 ms 47480 KB Output is correct
55 Correct 52 ms 47992 KB Output is correct
56 Correct 51 ms 47936 KB Output is correct
57 Correct 51 ms 47992 KB Output is correct
58 Correct 48 ms 47352 KB Output is correct
59 Correct 48 ms 47352 KB Output is correct
60 Correct 49 ms 47352 KB Output is correct
61 Correct 49 ms 47608 KB Output is correct
62 Correct 48 ms 47480 KB Output is correct
63 Correct 52 ms 47480 KB Output is correct
64 Correct 48 ms 47352 KB Output is correct
65 Correct 51 ms 47748 KB Output is correct
66 Correct 52 ms 47324 KB Output is correct
67 Correct 48 ms 47352 KB Output is correct
68 Correct 48 ms 47352 KB Output is correct
69 Correct 48 ms 47352 KB Output is correct
70 Correct 49 ms 47480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 47480 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 48 ms 47404 KB Output is correct
4 Correct 47 ms 47224 KB Output is correct
5 Correct 48 ms 47352 KB Output is correct
6 Correct 48 ms 47352 KB Output is correct
7 Correct 48 ms 47356 KB Output is correct
8 Correct 49 ms 47352 KB Output is correct
9 Correct 48 ms 47352 KB Output is correct
10 Correct 48 ms 47352 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47420 KB Output is correct
13 Correct 48 ms 47352 KB Output is correct
14 Correct 48 ms 47352 KB Output is correct
15 Correct 48 ms 47276 KB Output is correct
16 Correct 48 ms 47480 KB Output is correct
17 Correct 48 ms 47352 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47344 KB Output is correct
20 Correct 48 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 48 ms 47352 KB Output is correct
23 Correct 48 ms 47296 KB Output is correct
24 Correct 48 ms 47352 KB Output is correct
25 Correct 48 ms 47352 KB Output is correct
26 Correct 48 ms 47480 KB Output is correct
27 Correct 48 ms 47488 KB Output is correct
28 Correct 48 ms 47352 KB Output is correct
29 Correct 48 ms 47324 KB Output is correct
30 Correct 48 ms 47424 KB Output is correct
31 Correct 49 ms 47480 KB Output is correct
32 Correct 48 ms 47352 KB Output is correct
33 Correct 48 ms 47356 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 48 ms 47352 KB Output is correct
36 Correct 48 ms 47480 KB Output is correct
37 Correct 48 ms 47356 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47456 KB Output is correct
40 Correct 48 ms 47332 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47352 KB Output is correct
43 Correct 49 ms 47324 KB Output is correct
44 Correct 48 ms 47352 KB Output is correct
45 Correct 48 ms 47352 KB Output is correct
46 Correct 48 ms 47352 KB Output is correct
47 Correct 48 ms 47352 KB Output is correct
48 Correct 49 ms 47508 KB Output is correct
49 Correct 49 ms 47352 KB Output is correct
50 Correct 51 ms 47864 KB Output is correct
51 Correct 51 ms 47668 KB Output is correct
52 Correct 50 ms 47708 KB Output is correct
53 Correct 50 ms 47736 KB Output is correct
54 Correct 49 ms 47480 KB Output is correct
55 Correct 52 ms 47992 KB Output is correct
56 Correct 51 ms 47936 KB Output is correct
57 Correct 51 ms 47992 KB Output is correct
58 Correct 48 ms 47352 KB Output is correct
59 Correct 48 ms 47352 KB Output is correct
60 Correct 49 ms 47352 KB Output is correct
61 Correct 49 ms 47608 KB Output is correct
62 Correct 48 ms 47480 KB Output is correct
63 Correct 52 ms 47480 KB Output is correct
64 Correct 48 ms 47352 KB Output is correct
65 Correct 51 ms 47748 KB Output is correct
66 Correct 52 ms 47324 KB Output is correct
67 Correct 48 ms 47352 KB Output is correct
68 Correct 48 ms 47352 KB Output is correct
69 Correct 48 ms 47352 KB Output is correct
70 Correct 49 ms 47480 KB Output is correct
71 Correct 368 ms 86844 KB Output is correct
72 Correct 266 ms 74664 KB Output is correct
73 Correct 352 ms 85208 KB Output is correct
74 Correct 221 ms 68080 KB Output is correct
75 Correct 243 ms 70228 KB Output is correct
76 Correct 561 ms 107952 KB Output is correct
77 Correct 516 ms 102860 KB Output is correct
78 Correct 449 ms 95884 KB Output is correct
79 Correct 444 ms 97076 KB Output is correct
80 Correct 48 ms 47352 KB Output is correct
81 Correct 48 ms 47352 KB Output is correct
82 Correct 50 ms 47736 KB Output is correct
83 Correct 89 ms 52804 KB Output is correct
84 Correct 102 ms 54460 KB Output is correct
85 Correct 59 ms 49016 KB Output is correct
86 Correct 49 ms 47352 KB Output is correct
87 Correct 106 ms 54736 KB Output is correct
88 Correct 48 ms 47392 KB Output is correct
89 Correct 48 ms 47480 KB Output is correct
90 Correct 48 ms 47352 KB Output is correct
91 Correct 63 ms 49372 KB Output is correct
92 Correct 117 ms 56284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 47480 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 48 ms 47404 KB Output is correct
4 Correct 47 ms 47224 KB Output is correct
5 Correct 48 ms 47352 KB Output is correct
6 Correct 48 ms 47352 KB Output is correct
7 Correct 48 ms 47356 KB Output is correct
8 Correct 49 ms 47352 KB Output is correct
9 Correct 48 ms 47352 KB Output is correct
10 Correct 48 ms 47352 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47420 KB Output is correct
13 Correct 48 ms 47352 KB Output is correct
14 Correct 48 ms 47352 KB Output is correct
15 Correct 48 ms 47276 KB Output is correct
16 Correct 48 ms 47480 KB Output is correct
17 Correct 48 ms 47352 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47344 KB Output is correct
20 Correct 48 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 48 ms 47352 KB Output is correct
23 Correct 48 ms 47296 KB Output is correct
24 Correct 48 ms 47352 KB Output is correct
25 Correct 48 ms 47352 KB Output is correct
26 Correct 48 ms 47480 KB Output is correct
27 Correct 48 ms 47488 KB Output is correct
28 Correct 48 ms 47352 KB Output is correct
29 Correct 48 ms 47324 KB Output is correct
30 Correct 48 ms 47424 KB Output is correct
31 Correct 49 ms 47480 KB Output is correct
32 Correct 48 ms 47352 KB Output is correct
33 Correct 48 ms 47356 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 48 ms 47352 KB Output is correct
36 Correct 48 ms 47480 KB Output is correct
37 Correct 48 ms 47356 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47456 KB Output is correct
40 Correct 48 ms 47332 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47352 KB Output is correct
43 Correct 49 ms 47324 KB Output is correct
44 Correct 48 ms 47352 KB Output is correct
45 Correct 48 ms 47352 KB Output is correct
46 Correct 48 ms 47352 KB Output is correct
47 Correct 48 ms 47352 KB Output is correct
48 Correct 49 ms 47508 KB Output is correct
49 Correct 49 ms 47352 KB Output is correct
50 Correct 51 ms 47864 KB Output is correct
51 Correct 51 ms 47668 KB Output is correct
52 Correct 50 ms 47708 KB Output is correct
53 Correct 50 ms 47736 KB Output is correct
54 Correct 49 ms 47480 KB Output is correct
55 Correct 52 ms 47992 KB Output is correct
56 Correct 51 ms 47936 KB Output is correct
57 Correct 51 ms 47992 KB Output is correct
58 Correct 48 ms 47352 KB Output is correct
59 Correct 48 ms 47352 KB Output is correct
60 Correct 49 ms 47352 KB Output is correct
61 Correct 49 ms 47608 KB Output is correct
62 Correct 48 ms 47480 KB Output is correct
63 Correct 52 ms 47480 KB Output is correct
64 Correct 48 ms 47352 KB Output is correct
65 Correct 51 ms 47748 KB Output is correct
66 Correct 52 ms 47324 KB Output is correct
67 Correct 48 ms 47352 KB Output is correct
68 Correct 48 ms 47352 KB Output is correct
69 Correct 48 ms 47352 KB Output is correct
70 Correct 49 ms 47480 KB Output is correct
71 Correct 368 ms 86844 KB Output is correct
72 Correct 266 ms 74664 KB Output is correct
73 Correct 352 ms 85208 KB Output is correct
74 Correct 221 ms 68080 KB Output is correct
75 Correct 243 ms 70228 KB Output is correct
76 Correct 561 ms 107952 KB Output is correct
77 Correct 516 ms 102860 KB Output is correct
78 Correct 449 ms 95884 KB Output is correct
79 Correct 444 ms 97076 KB Output is correct
80 Correct 48 ms 47352 KB Output is correct
81 Correct 48 ms 47352 KB Output is correct
82 Correct 50 ms 47736 KB Output is correct
83 Correct 89 ms 52804 KB Output is correct
84 Correct 102 ms 54460 KB Output is correct
85 Correct 59 ms 49016 KB Output is correct
86 Correct 49 ms 47352 KB Output is correct
87 Correct 106 ms 54736 KB Output is correct
88 Correct 48 ms 47392 KB Output is correct
89 Correct 48 ms 47480 KB Output is correct
90 Correct 48 ms 47352 KB Output is correct
91 Correct 63 ms 49372 KB Output is correct
92 Correct 117 ms 56284 KB Output is correct
93 Runtime error 1538 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
94 Halted 0 ms 0 KB -