답안 #168826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168826 2019-12-16T15:45:38 Z kostia244 Toys (CEOI18_toy) C++17
39 / 100
57 ms 47624 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<int>;
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]);
	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")
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 47352 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 56 ms 47352 KB Output is correct
4 Correct 55 ms 47356 KB Output is correct
5 Correct 56 ms 47352 KB Output is correct
6 Correct 56 ms 47352 KB Output is correct
7 Correct 55 ms 47352 KB Output is correct
8 Correct 48 ms 47356 KB Output is correct
9 Correct 48 ms 47480 KB Output is correct
10 Correct 50 ms 47480 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47372 KB Output is correct
13 Correct 55 ms 47356 KB Output is correct
14 Correct 48 ms 47392 KB Output is correct
15 Correct 49 ms 47324 KB Output is correct
16 Correct 48 ms 47352 KB Output is correct
17 Correct 48 ms 47348 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47428 KB Output is correct
20 Correct 49 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 49 ms 47328 KB Output is correct
23 Correct 49 ms 47352 KB Output is correct
24 Correct 48 ms 47484 KB Output is correct
25 Correct 52 ms 47480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 47352 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 56 ms 47352 KB Output is correct
4 Correct 55 ms 47356 KB Output is correct
5 Correct 56 ms 47352 KB Output is correct
6 Correct 56 ms 47352 KB Output is correct
7 Correct 55 ms 47352 KB Output is correct
8 Correct 48 ms 47356 KB Output is correct
9 Correct 48 ms 47480 KB Output is correct
10 Correct 50 ms 47480 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47372 KB Output is correct
13 Correct 55 ms 47356 KB Output is correct
14 Correct 48 ms 47392 KB Output is correct
15 Correct 49 ms 47324 KB Output is correct
16 Correct 48 ms 47352 KB Output is correct
17 Correct 48 ms 47348 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47428 KB Output is correct
20 Correct 49 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 49 ms 47328 KB Output is correct
23 Correct 49 ms 47352 KB Output is correct
24 Correct 48 ms 47484 KB Output is correct
25 Correct 52 ms 47480 KB Output is correct
26 Correct 57 ms 47452 KB Output is correct
27 Correct 55 ms 47352 KB Output is correct
28 Correct 56 ms 47328 KB Output is correct
29 Correct 48 ms 47352 KB Output is correct
30 Correct 55 ms 47352 KB Output is correct
31 Correct 54 ms 47480 KB Output is correct
32 Correct 49 ms 47352 KB Output is correct
33 Correct 49 ms 47480 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 49 ms 47352 KB Output is correct
36 Correct 48 ms 47352 KB Output is correct
37 Correct 48 ms 47352 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47352 KB Output is correct
40 Correct 48 ms 47328 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47480 KB Output is correct
43 Correct 48 ms 47352 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 48 ms 47352 KB Output is correct
49 Correct 49 ms 47392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 47352 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 56 ms 47352 KB Output is correct
4 Correct 55 ms 47356 KB Output is correct
5 Correct 56 ms 47352 KB Output is correct
6 Correct 56 ms 47352 KB Output is correct
7 Correct 55 ms 47352 KB Output is correct
8 Correct 48 ms 47356 KB Output is correct
9 Correct 48 ms 47480 KB Output is correct
10 Correct 50 ms 47480 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47372 KB Output is correct
13 Correct 55 ms 47356 KB Output is correct
14 Correct 48 ms 47392 KB Output is correct
15 Correct 49 ms 47324 KB Output is correct
16 Correct 48 ms 47352 KB Output is correct
17 Correct 48 ms 47348 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47428 KB Output is correct
20 Correct 49 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 49 ms 47328 KB Output is correct
23 Correct 49 ms 47352 KB Output is correct
24 Correct 48 ms 47484 KB Output is correct
25 Correct 52 ms 47480 KB Output is correct
26 Correct 57 ms 47452 KB Output is correct
27 Correct 55 ms 47352 KB Output is correct
28 Correct 56 ms 47328 KB Output is correct
29 Correct 48 ms 47352 KB Output is correct
30 Correct 55 ms 47352 KB Output is correct
31 Correct 54 ms 47480 KB Output is correct
32 Correct 49 ms 47352 KB Output is correct
33 Correct 49 ms 47480 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 49 ms 47352 KB Output is correct
36 Correct 48 ms 47352 KB Output is correct
37 Correct 48 ms 47352 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47352 KB Output is correct
40 Correct 48 ms 47328 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47480 KB Output is correct
43 Correct 48 ms 47352 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 48 ms 47352 KB Output is correct
49 Correct 49 ms 47392 KB Output is correct
50 Incorrect 50 ms 47624 KB Output isn't correct
51 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 47352 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 56 ms 47352 KB Output is correct
4 Correct 55 ms 47356 KB Output is correct
5 Correct 56 ms 47352 KB Output is correct
6 Correct 56 ms 47352 KB Output is correct
7 Correct 55 ms 47352 KB Output is correct
8 Correct 48 ms 47356 KB Output is correct
9 Correct 48 ms 47480 KB Output is correct
10 Correct 50 ms 47480 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47372 KB Output is correct
13 Correct 55 ms 47356 KB Output is correct
14 Correct 48 ms 47392 KB Output is correct
15 Correct 49 ms 47324 KB Output is correct
16 Correct 48 ms 47352 KB Output is correct
17 Correct 48 ms 47348 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47428 KB Output is correct
20 Correct 49 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 49 ms 47328 KB Output is correct
23 Correct 49 ms 47352 KB Output is correct
24 Correct 48 ms 47484 KB Output is correct
25 Correct 52 ms 47480 KB Output is correct
26 Correct 57 ms 47452 KB Output is correct
27 Correct 55 ms 47352 KB Output is correct
28 Correct 56 ms 47328 KB Output is correct
29 Correct 48 ms 47352 KB Output is correct
30 Correct 55 ms 47352 KB Output is correct
31 Correct 54 ms 47480 KB Output is correct
32 Correct 49 ms 47352 KB Output is correct
33 Correct 49 ms 47480 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 49 ms 47352 KB Output is correct
36 Correct 48 ms 47352 KB Output is correct
37 Correct 48 ms 47352 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47352 KB Output is correct
40 Correct 48 ms 47328 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47480 KB Output is correct
43 Correct 48 ms 47352 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 48 ms 47352 KB Output is correct
49 Correct 49 ms 47392 KB Output is correct
50 Incorrect 50 ms 47624 KB Output isn't correct
51 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 47352 KB Output is correct
2 Correct 48 ms 47352 KB Output is correct
3 Correct 56 ms 47352 KB Output is correct
4 Correct 55 ms 47356 KB Output is correct
5 Correct 56 ms 47352 KB Output is correct
6 Correct 56 ms 47352 KB Output is correct
7 Correct 55 ms 47352 KB Output is correct
8 Correct 48 ms 47356 KB Output is correct
9 Correct 48 ms 47480 KB Output is correct
10 Correct 50 ms 47480 KB Output is correct
11 Correct 48 ms 47352 KB Output is correct
12 Correct 48 ms 47372 KB Output is correct
13 Correct 55 ms 47356 KB Output is correct
14 Correct 48 ms 47392 KB Output is correct
15 Correct 49 ms 47324 KB Output is correct
16 Correct 48 ms 47352 KB Output is correct
17 Correct 48 ms 47348 KB Output is correct
18 Correct 48 ms 47352 KB Output is correct
19 Correct 48 ms 47428 KB Output is correct
20 Correct 49 ms 47352 KB Output is correct
21 Correct 48 ms 47352 KB Output is correct
22 Correct 49 ms 47328 KB Output is correct
23 Correct 49 ms 47352 KB Output is correct
24 Correct 48 ms 47484 KB Output is correct
25 Correct 52 ms 47480 KB Output is correct
26 Correct 57 ms 47452 KB Output is correct
27 Correct 55 ms 47352 KB Output is correct
28 Correct 56 ms 47328 KB Output is correct
29 Correct 48 ms 47352 KB Output is correct
30 Correct 55 ms 47352 KB Output is correct
31 Correct 54 ms 47480 KB Output is correct
32 Correct 49 ms 47352 KB Output is correct
33 Correct 49 ms 47480 KB Output is correct
34 Correct 48 ms 47352 KB Output is correct
35 Correct 49 ms 47352 KB Output is correct
36 Correct 48 ms 47352 KB Output is correct
37 Correct 48 ms 47352 KB Output is correct
38 Correct 48 ms 47352 KB Output is correct
39 Correct 48 ms 47352 KB Output is correct
40 Correct 48 ms 47328 KB Output is correct
41 Correct 48 ms 47352 KB Output is correct
42 Correct 48 ms 47480 KB Output is correct
43 Correct 48 ms 47352 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 48 ms 47352 KB Output is correct
49 Correct 49 ms 47392 KB Output is correct
50 Incorrect 50 ms 47624 KB Output isn't correct
51 Halted 0 ms 0 KB -