답안 #169845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169845 2019-12-23T00:56:29 Z arnold518 Toys (CEOI18_toy) C++14
100 / 100
1943 ms 217424 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll MAXN = 1e9;

ll N;
vector<ll> V;
vector<vector<ll>> dp;

int main()
{
	ll i, j;

	scanf("%lld", &N);
	for(i=1; i*i<=N; i++)
	{
		if(N%i) continue;
		V.push_back(i);
		V.push_back(N/i);
	}

	sort(V.begin(), V.end());
	V.erase(unique(V.begin(), V.end()), V.end());

	dp.resize(V.size());
	dp[0].push_back(0);
	for(i=1; i<V.size(); i++)
	{
		for(j=0; j<i; j++)
		{
			if(V[i]%V[j]) continue;
			for(auto it : dp[j]) dp[i].push_back(it+V[i]/V[j]-1);
		}
		sort(dp[i].begin(), dp[i].end());
		dp[i].erase(unique(dp[i].begin(), dp[i].end()), dp[i].end());
	}

	printf("%d\n", dp.back().size());
	for(auto it : dp.back()) printf("%d ", it);
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:31:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1; i<V.size(); i++)
           ~^~~~~~~~~
toy.cpp:42:33: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<long long int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d\n", dp.back().size());
                 ~~~~~~~~~~~~~~~~^
toy.cpp:43:43: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  for(auto it : dp.back()) printf("%d ", it);
                                           ^
toy.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
  ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 360 KB Output is correct
41 Correct 2 ms 420 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 256 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 360 KB Output is correct
41 Correct 2 ms 420 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 256 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 4 ms 632 KB Output is correct
51 Correct 4 ms 632 KB Output is correct
52 Correct 4 ms 632 KB Output is correct
53 Correct 4 ms 632 KB Output is correct
54 Correct 3 ms 504 KB Output is correct
55 Correct 6 ms 760 KB Output is correct
56 Correct 5 ms 760 KB Output is correct
57 Correct 5 ms 764 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 376 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 3 ms 504 KB Output is correct
62 Correct 3 ms 504 KB Output is correct
63 Correct 2 ms 376 KB Output is correct
64 Correct 2 ms 424 KB Output is correct
65 Correct 3 ms 504 KB Output is correct
66 Correct 2 ms 376 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 376 KB Output is correct
70 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 360 KB Output is correct
41 Correct 2 ms 420 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 256 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 4 ms 632 KB Output is correct
51 Correct 4 ms 632 KB Output is correct
52 Correct 4 ms 632 KB Output is correct
53 Correct 4 ms 632 KB Output is correct
54 Correct 3 ms 504 KB Output is correct
55 Correct 6 ms 760 KB Output is correct
56 Correct 5 ms 760 KB Output is correct
57 Correct 5 ms 764 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 376 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 3 ms 504 KB Output is correct
62 Correct 3 ms 504 KB Output is correct
63 Correct 2 ms 376 KB Output is correct
64 Correct 2 ms 424 KB Output is correct
65 Correct 3 ms 504 KB Output is correct
66 Correct 2 ms 376 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 376 KB Output is correct
70 Correct 3 ms 376 KB Output is correct
71 Correct 290 ms 34516 KB Output is correct
72 Correct 201 ms 25296 KB Output is correct
73 Correct 276 ms 33320 KB Output is correct
74 Correct 149 ms 17976 KB Output is correct
75 Correct 175 ms 20972 KB Output is correct
76 Correct 450 ms 52672 KB Output is correct
77 Correct 409 ms 48612 KB Output is correct
78 Correct 353 ms 41360 KB Output is correct
79 Correct 349 ms 42084 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 376 KB Output is correct
82 Correct 4 ms 632 KB Output is correct
83 Correct 40 ms 5232 KB Output is correct
84 Correct 52 ms 6896 KB Output is correct
85 Correct 12 ms 1656 KB Output is correct
86 Correct 2 ms 376 KB Output is correct
87 Correct 56 ms 7152 KB Output is correct
88 Correct 2 ms 256 KB Output is correct
89 Correct 2 ms 376 KB Output is correct
90 Correct 2 ms 376 KB Output is correct
91 Correct 16 ms 2040 KB Output is correct
92 Correct 66 ms 7952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 380 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 360 KB Output is correct
41 Correct 2 ms 420 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 256 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 4 ms 632 KB Output is correct
51 Correct 4 ms 632 KB Output is correct
52 Correct 4 ms 632 KB Output is correct
53 Correct 4 ms 632 KB Output is correct
54 Correct 3 ms 504 KB Output is correct
55 Correct 6 ms 760 KB Output is correct
56 Correct 5 ms 760 KB Output is correct
57 Correct 5 ms 764 KB Output is correct
58 Correct 2 ms 376 KB Output is correct
59 Correct 2 ms 376 KB Output is correct
60 Correct 2 ms 376 KB Output is correct
61 Correct 3 ms 504 KB Output is correct
62 Correct 3 ms 504 KB Output is correct
63 Correct 2 ms 376 KB Output is correct
64 Correct 2 ms 424 KB Output is correct
65 Correct 3 ms 504 KB Output is correct
66 Correct 2 ms 376 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 376 KB Output is correct
70 Correct 3 ms 376 KB Output is correct
71 Correct 290 ms 34516 KB Output is correct
72 Correct 201 ms 25296 KB Output is correct
73 Correct 276 ms 33320 KB Output is correct
74 Correct 149 ms 17976 KB Output is correct
75 Correct 175 ms 20972 KB Output is correct
76 Correct 450 ms 52672 KB Output is correct
77 Correct 409 ms 48612 KB Output is correct
78 Correct 353 ms 41360 KB Output is correct
79 Correct 349 ms 42084 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 376 KB Output is correct
82 Correct 4 ms 632 KB Output is correct
83 Correct 40 ms 5232 KB Output is correct
84 Correct 52 ms 6896 KB Output is correct
85 Correct 12 ms 1656 KB Output is correct
86 Correct 2 ms 376 KB Output is correct
87 Correct 56 ms 7152 KB Output is correct
88 Correct 2 ms 256 KB Output is correct
89 Correct 2 ms 376 KB Output is correct
90 Correct 2 ms 376 KB Output is correct
91 Correct 16 ms 2040 KB Output is correct
92 Correct 66 ms 7952 KB Output is correct
93 Correct 1606 ms 179228 KB Output is correct
94 Correct 876 ms 100568 KB Output is correct
95 Correct 1025 ms 123544 KB Output is correct
96 Correct 910 ms 103848 KB Output is correct
97 Correct 835 ms 96704 KB Output is correct
98 Correct 1822 ms 205836 KB Output is correct
99 Correct 1943 ms 217424 KB Output is correct
100 Correct 1801 ms 202348 KB Output is correct
101 Correct 1779 ms 194948 KB Output is correct
102 Correct 1501 ms 171164 KB Output is correct
103 Correct 1178 ms 138108 KB Output is correct
104 Correct 2 ms 256 KB Output is correct
105 Correct 2 ms 256 KB Output is correct
106 Correct 6 ms 1016 KB Output is correct
107 Correct 128 ms 15464 KB Output is correct
108 Correct 329 ms 38304 KB Output is correct
109 Correct 29 ms 3760 KB Output is correct
110 Correct 2 ms 256 KB Output is correct
111 Correct 160 ms 19612 KB Output is correct
112 Correct 2 ms 376 KB Output is correct
113 Correct 2 ms 256 KB Output is correct
114 Correct 6 ms 888 KB Output is correct
115 Correct 2 ms 376 KB Output is correct
116 Correct 12 ms 1628 KB Output is correct
117 Correct 305 ms 34284 KB Output is correct