# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
538013 | 2022-03-16T03:07:30 Z | jamielim | Toys (CEOI18_toy) | C++14 | 5000 ms | 120136 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb emplace_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() typedef long long ll; typedef pair<int,int> ii; typedef pair<ii,ii> i4; const int MOD=1000000007; const int INF=1012345678; const ll LLINF=1012345678012345678LL; const double PI=3.1415926536; const double EPS=1e-14; int n; vector<int> memo[5000005]; vector<int> dp(int n){ if(n<100005&&!memo[n].empty())return memo[n]; set<int> s; for(int i=2;i*i<=n;i++){ if(n%i!=0)continue; vector<int> y=dp(n/i); for(int j:y){ s.insert(j+i-1); } } s.insert(n-1); vector<int> ans; for(int i:s)ans.pb(i); if(n<100005)memo[n]=ans; return ans; } int main(){ scanf("%d",&n); vector<int> ans=dp(n); sort(ALL(ans)); printf("%d\n",SZ(ans)); for(int i:ans){ printf("%d ",i); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 117600 KB | Output is correct |
2 | Correct | 59 ms | 117580 KB | Output is correct |
3 | Correct | 60 ms | 117668 KB | Output is correct |
4 | Correct | 62 ms | 117596 KB | Output is correct |
5 | Correct | 61 ms | 117696 KB | Output is correct |
6 | Correct | 71 ms | 117632 KB | Output is correct |
7 | Correct | 60 ms | 117620 KB | Output is correct |
8 | Correct | 59 ms | 117640 KB | Output is correct |
9 | Correct | 58 ms | 117716 KB | Output is correct |
10 | Correct | 62 ms | 117696 KB | Output is correct |
11 | Correct | 59 ms | 117680 KB | Output is correct |
12 | Correct | 59 ms | 117576 KB | Output is correct |
13 | Correct | 62 ms | 117700 KB | Output is correct |
14 | Correct | 68 ms | 117700 KB | Output is correct |
15 | Correct | 62 ms | 117660 KB | Output is correct |
16 | Correct | 59 ms | 117588 KB | Output is correct |
17 | Correct | 58 ms | 117656 KB | Output is correct |
18 | Correct | 63 ms | 117696 KB | Output is correct |
19 | Correct | 63 ms | 117604 KB | Output is correct |
20 | Correct | 72 ms | 117672 KB | Output is correct |
21 | Correct | 60 ms | 117688 KB | Output is correct |
22 | Correct | 58 ms | 117660 KB | Output is correct |
23 | Correct | 60 ms | 117616 KB | Output is correct |
24 | Correct | 63 ms | 117696 KB | Output is correct |
25 | Correct | 67 ms | 117704 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 117600 KB | Output is correct |
2 | Correct | 59 ms | 117580 KB | Output is correct |
3 | Correct | 60 ms | 117668 KB | Output is correct |
4 | Correct | 62 ms | 117596 KB | Output is correct |
5 | Correct | 61 ms | 117696 KB | Output is correct |
6 | Correct | 71 ms | 117632 KB | Output is correct |
7 | Correct | 60 ms | 117620 KB | Output is correct |
8 | Correct | 59 ms | 117640 KB | Output is correct |
9 | Correct | 58 ms | 117716 KB | Output is correct |
10 | Correct | 62 ms | 117696 KB | Output is correct |
11 | Correct | 59 ms | 117680 KB | Output is correct |
12 | Correct | 59 ms | 117576 KB | Output is correct |
13 | Correct | 62 ms | 117700 KB | Output is correct |
14 | Correct | 68 ms | 117700 KB | Output is correct |
15 | Correct | 62 ms | 117660 KB | Output is correct |
16 | Correct | 59 ms | 117588 KB | Output is correct |
17 | Correct | 58 ms | 117656 KB | Output is correct |
18 | Correct | 63 ms | 117696 KB | Output is correct |
19 | Correct | 63 ms | 117604 KB | Output is correct |
20 | Correct | 72 ms | 117672 KB | Output is correct |
21 | Correct | 60 ms | 117688 KB | Output is correct |
22 | Correct | 58 ms | 117660 KB | Output is correct |
23 | Correct | 60 ms | 117616 KB | Output is correct |
24 | Correct | 63 ms | 117696 KB | Output is correct |
25 | Correct | 67 ms | 117704 KB | Output is correct |
26 | Correct | 59 ms | 117692 KB | Output is correct |
27 | Correct | 60 ms | 117720 KB | Output is correct |
28 | Correct | 65 ms | 117620 KB | Output is correct |
29 | Correct | 63 ms | 117704 KB | Output is correct |
30 | Correct | 61 ms | 117592 KB | Output is correct |
31 | Correct | 60 ms | 117644 KB | Output is correct |
32 | Correct | 59 ms | 117708 KB | Output is correct |
33 | Correct | 60 ms | 117728 KB | Output is correct |
34 | Correct | 62 ms | 117664 KB | Output is correct |
35 | Correct | 62 ms | 117608 KB | Output is correct |
36 | Correct | 61 ms | 117708 KB | Output is correct |
37 | Correct | 61 ms | 117652 KB | Output is correct |
38 | Correct | 59 ms | 117656 KB | Output is correct |
39 | Correct | 61 ms | 117576 KB | Output is correct |
40 | Correct | 60 ms | 117716 KB | Output is correct |
41 | Correct | 59 ms | 117704 KB | Output is correct |
42 | Correct | 63 ms | 117684 KB | Output is correct |
43 | Correct | 62 ms | 117700 KB | Output is correct |
44 | Correct | 60 ms | 117796 KB | Output is correct |
45 | Correct | 59 ms | 117704 KB | Output is correct |
46 | Correct | 59 ms | 117672 KB | Output is correct |
47 | Correct | 59 ms | 117704 KB | Output is correct |
48 | Correct | 73 ms | 117604 KB | Output is correct |
49 | Correct | 63 ms | 117680 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 117600 KB | Output is correct |
2 | Correct | 59 ms | 117580 KB | Output is correct |
3 | Correct | 60 ms | 117668 KB | Output is correct |
4 | Correct | 62 ms | 117596 KB | Output is correct |
5 | Correct | 61 ms | 117696 KB | Output is correct |
6 | Correct | 71 ms | 117632 KB | Output is correct |
7 | Correct | 60 ms | 117620 KB | Output is correct |
8 | Correct | 59 ms | 117640 KB | Output is correct |
9 | Correct | 58 ms | 117716 KB | Output is correct |
10 | Correct | 62 ms | 117696 KB | Output is correct |
11 | Correct | 59 ms | 117680 KB | Output is correct |
12 | Correct | 59 ms | 117576 KB | Output is correct |
13 | Correct | 62 ms | 117700 KB | Output is correct |
14 | Correct | 68 ms | 117700 KB | Output is correct |
15 | Correct | 62 ms | 117660 KB | Output is correct |
16 | Correct | 59 ms | 117588 KB | Output is correct |
17 | Correct | 58 ms | 117656 KB | Output is correct |
18 | Correct | 63 ms | 117696 KB | Output is correct |
19 | Correct | 63 ms | 117604 KB | Output is correct |
20 | Correct | 72 ms | 117672 KB | Output is correct |
21 | Correct | 60 ms | 117688 KB | Output is correct |
22 | Correct | 58 ms | 117660 KB | Output is correct |
23 | Correct | 60 ms | 117616 KB | Output is correct |
24 | Correct | 63 ms | 117696 KB | Output is correct |
25 | Correct | 67 ms | 117704 KB | Output is correct |
26 | Correct | 59 ms | 117692 KB | Output is correct |
27 | Correct | 60 ms | 117720 KB | Output is correct |
28 | Correct | 65 ms | 117620 KB | Output is correct |
29 | Correct | 63 ms | 117704 KB | Output is correct |
30 | Correct | 61 ms | 117592 KB | Output is correct |
31 | Correct | 60 ms | 117644 KB | Output is correct |
32 | Correct | 59 ms | 117708 KB | Output is correct |
33 | Correct | 60 ms | 117728 KB | Output is correct |
34 | Correct | 62 ms | 117664 KB | Output is correct |
35 | Correct | 62 ms | 117608 KB | Output is correct |
36 | Correct | 61 ms | 117708 KB | Output is correct |
37 | Correct | 61 ms | 117652 KB | Output is correct |
38 | Correct | 59 ms | 117656 KB | Output is correct |
39 | Correct | 61 ms | 117576 KB | Output is correct |
40 | Correct | 60 ms | 117716 KB | Output is correct |
41 | Correct | 59 ms | 117704 KB | Output is correct |
42 | Correct | 63 ms | 117684 KB | Output is correct |
43 | Correct | 62 ms | 117700 KB | Output is correct |
44 | Correct | 60 ms | 117796 KB | Output is correct |
45 | Correct | 59 ms | 117704 KB | Output is correct |
46 | Correct | 59 ms | 117672 KB | Output is correct |
47 | Correct | 59 ms | 117704 KB | Output is correct |
48 | Correct | 73 ms | 117604 KB | Output is correct |
49 | Correct | 63 ms | 117680 KB | Output is correct |
50 | Correct | 63 ms | 117756 KB | Output is correct |
51 | Correct | 59 ms | 117684 KB | Output is correct |
52 | Correct | 63 ms | 117740 KB | Output is correct |
53 | Correct | 61 ms | 117772 KB | Output is correct |
54 | Correct | 61 ms | 117696 KB | Output is correct |
55 | Correct | 67 ms | 117672 KB | Output is correct |
56 | Correct | 65 ms | 117780 KB | Output is correct |
57 | Correct | 61 ms | 117728 KB | Output is correct |
58 | Correct | 62 ms | 117616 KB | Output is correct |
59 | Correct | 60 ms | 117696 KB | Output is correct |
60 | Correct | 62 ms | 117708 KB | Output is correct |
61 | Correct | 65 ms | 117708 KB | Output is correct |
62 | Correct | 59 ms | 117716 KB | Output is correct |
63 | Correct | 59 ms | 117648 KB | Output is correct |
64 | Correct | 61 ms | 117680 KB | Output is correct |
65 | Correct | 64 ms | 117660 KB | Output is correct |
66 | Correct | 58 ms | 117660 KB | Output is correct |
67 | Correct | 59 ms | 117640 KB | Output is correct |
68 | Correct | 63 ms | 117704 KB | Output is correct |
69 | Correct | 61 ms | 117664 KB | Output is correct |
70 | Correct | 68 ms | 117608 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 117600 KB | Output is correct |
2 | Correct | 59 ms | 117580 KB | Output is correct |
3 | Correct | 60 ms | 117668 KB | Output is correct |
4 | Correct | 62 ms | 117596 KB | Output is correct |
5 | Correct | 61 ms | 117696 KB | Output is correct |
6 | Correct | 71 ms | 117632 KB | Output is correct |
7 | Correct | 60 ms | 117620 KB | Output is correct |
8 | Correct | 59 ms | 117640 KB | Output is correct |
9 | Correct | 58 ms | 117716 KB | Output is correct |
10 | Correct | 62 ms | 117696 KB | Output is correct |
11 | Correct | 59 ms | 117680 KB | Output is correct |
12 | Correct | 59 ms | 117576 KB | Output is correct |
13 | Correct | 62 ms | 117700 KB | Output is correct |
14 | Correct | 68 ms | 117700 KB | Output is correct |
15 | Correct | 62 ms | 117660 KB | Output is correct |
16 | Correct | 59 ms | 117588 KB | Output is correct |
17 | Correct | 58 ms | 117656 KB | Output is correct |
18 | Correct | 63 ms | 117696 KB | Output is correct |
19 | Correct | 63 ms | 117604 KB | Output is correct |
20 | Correct | 72 ms | 117672 KB | Output is correct |
21 | Correct | 60 ms | 117688 KB | Output is correct |
22 | Correct | 58 ms | 117660 KB | Output is correct |
23 | Correct | 60 ms | 117616 KB | Output is correct |
24 | Correct | 63 ms | 117696 KB | Output is correct |
25 | Correct | 67 ms | 117704 KB | Output is correct |
26 | Correct | 59 ms | 117692 KB | Output is correct |
27 | Correct | 60 ms | 117720 KB | Output is correct |
28 | Correct | 65 ms | 117620 KB | Output is correct |
29 | Correct | 63 ms | 117704 KB | Output is correct |
30 | Correct | 61 ms | 117592 KB | Output is correct |
31 | Correct | 60 ms | 117644 KB | Output is correct |
32 | Correct | 59 ms | 117708 KB | Output is correct |
33 | Correct | 60 ms | 117728 KB | Output is correct |
34 | Correct | 62 ms | 117664 KB | Output is correct |
35 | Correct | 62 ms | 117608 KB | Output is correct |
36 | Correct | 61 ms | 117708 KB | Output is correct |
37 | Correct | 61 ms | 117652 KB | Output is correct |
38 | Correct | 59 ms | 117656 KB | Output is correct |
39 | Correct | 61 ms | 117576 KB | Output is correct |
40 | Correct | 60 ms | 117716 KB | Output is correct |
41 | Correct | 59 ms | 117704 KB | Output is correct |
42 | Correct | 63 ms | 117684 KB | Output is correct |
43 | Correct | 62 ms | 117700 KB | Output is correct |
44 | Correct | 60 ms | 117796 KB | Output is correct |
45 | Correct | 59 ms | 117704 KB | Output is correct |
46 | Correct | 59 ms | 117672 KB | Output is correct |
47 | Correct | 59 ms | 117704 KB | Output is correct |
48 | Correct | 73 ms | 117604 KB | Output is correct |
49 | Correct | 63 ms | 117680 KB | Output is correct |
50 | Correct | 63 ms | 117756 KB | Output is correct |
51 | Correct | 59 ms | 117684 KB | Output is correct |
52 | Correct | 63 ms | 117740 KB | Output is correct |
53 | Correct | 61 ms | 117772 KB | Output is correct |
54 | Correct | 61 ms | 117696 KB | Output is correct |
55 | Correct | 67 ms | 117672 KB | Output is correct |
56 | Correct | 65 ms | 117780 KB | Output is correct |
57 | Correct | 61 ms | 117728 KB | Output is correct |
58 | Correct | 62 ms | 117616 KB | Output is correct |
59 | Correct | 60 ms | 117696 KB | Output is correct |
60 | Correct | 62 ms | 117708 KB | Output is correct |
61 | Correct | 65 ms | 117708 KB | Output is correct |
62 | Correct | 59 ms | 117716 KB | Output is correct |
63 | Correct | 59 ms | 117648 KB | Output is correct |
64 | Correct | 61 ms | 117680 KB | Output is correct |
65 | Correct | 64 ms | 117660 KB | Output is correct |
66 | Correct | 58 ms | 117660 KB | Output is correct |
67 | Correct | 59 ms | 117640 KB | Output is correct |
68 | Correct | 63 ms | 117704 KB | Output is correct |
69 | Correct | 61 ms | 117664 KB | Output is correct |
70 | Correct | 68 ms | 117608 KB | Output is correct |
71 | Correct | 2691 ms | 119764 KB | Output is correct |
72 | Correct | 1252 ms | 119308 KB | Output is correct |
73 | Correct | 2485 ms | 119744 KB | Output is correct |
74 | Correct | 794 ms | 119116 KB | Output is correct |
75 | Correct | 1030 ms | 119092 KB | Output is correct |
76 | Execution timed out | 5056 ms | 120136 KB | Time limit exceeded |
77 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 117600 KB | Output is correct |
2 | Correct | 59 ms | 117580 KB | Output is correct |
3 | Correct | 60 ms | 117668 KB | Output is correct |
4 | Correct | 62 ms | 117596 KB | Output is correct |
5 | Correct | 61 ms | 117696 KB | Output is correct |
6 | Correct | 71 ms | 117632 KB | Output is correct |
7 | Correct | 60 ms | 117620 KB | Output is correct |
8 | Correct | 59 ms | 117640 KB | Output is correct |
9 | Correct | 58 ms | 117716 KB | Output is correct |
10 | Correct | 62 ms | 117696 KB | Output is correct |
11 | Correct | 59 ms | 117680 KB | Output is correct |
12 | Correct | 59 ms | 117576 KB | Output is correct |
13 | Correct | 62 ms | 117700 KB | Output is correct |
14 | Correct | 68 ms | 117700 KB | Output is correct |
15 | Correct | 62 ms | 117660 KB | Output is correct |
16 | Correct | 59 ms | 117588 KB | Output is correct |
17 | Correct | 58 ms | 117656 KB | Output is correct |
18 | Correct | 63 ms | 117696 KB | Output is correct |
19 | Correct | 63 ms | 117604 KB | Output is correct |
20 | Correct | 72 ms | 117672 KB | Output is correct |
21 | Correct | 60 ms | 117688 KB | Output is correct |
22 | Correct | 58 ms | 117660 KB | Output is correct |
23 | Correct | 60 ms | 117616 KB | Output is correct |
24 | Correct | 63 ms | 117696 KB | Output is correct |
25 | Correct | 67 ms | 117704 KB | Output is correct |
26 | Correct | 59 ms | 117692 KB | Output is correct |
27 | Correct | 60 ms | 117720 KB | Output is correct |
28 | Correct | 65 ms | 117620 KB | Output is correct |
29 | Correct | 63 ms | 117704 KB | Output is correct |
30 | Correct | 61 ms | 117592 KB | Output is correct |
31 | Correct | 60 ms | 117644 KB | Output is correct |
32 | Correct | 59 ms | 117708 KB | Output is correct |
33 | Correct | 60 ms | 117728 KB | Output is correct |
34 | Correct | 62 ms | 117664 KB | Output is correct |
35 | Correct | 62 ms | 117608 KB | Output is correct |
36 | Correct | 61 ms | 117708 KB | Output is correct |
37 | Correct | 61 ms | 117652 KB | Output is correct |
38 | Correct | 59 ms | 117656 KB | Output is correct |
39 | Correct | 61 ms | 117576 KB | Output is correct |
40 | Correct | 60 ms | 117716 KB | Output is correct |
41 | Correct | 59 ms | 117704 KB | Output is correct |
42 | Correct | 63 ms | 117684 KB | Output is correct |
43 | Correct | 62 ms | 117700 KB | Output is correct |
44 | Correct | 60 ms | 117796 KB | Output is correct |
45 | Correct | 59 ms | 117704 KB | Output is correct |
46 | Correct | 59 ms | 117672 KB | Output is correct |
47 | Correct | 59 ms | 117704 KB | Output is correct |
48 | Correct | 73 ms | 117604 KB | Output is correct |
49 | Correct | 63 ms | 117680 KB | Output is correct |
50 | Correct | 63 ms | 117756 KB | Output is correct |
51 | Correct | 59 ms | 117684 KB | Output is correct |
52 | Correct | 63 ms | 117740 KB | Output is correct |
53 | Correct | 61 ms | 117772 KB | Output is correct |
54 | Correct | 61 ms | 117696 KB | Output is correct |
55 | Correct | 67 ms | 117672 KB | Output is correct |
56 | Correct | 65 ms | 117780 KB | Output is correct |
57 | Correct | 61 ms | 117728 KB | Output is correct |
58 | Correct | 62 ms | 117616 KB | Output is correct |
59 | Correct | 60 ms | 117696 KB | Output is correct |
60 | Correct | 62 ms | 117708 KB | Output is correct |
61 | Correct | 65 ms | 117708 KB | Output is correct |
62 | Correct | 59 ms | 117716 KB | Output is correct |
63 | Correct | 59 ms | 117648 KB | Output is correct |
64 | Correct | 61 ms | 117680 KB | Output is correct |
65 | Correct | 64 ms | 117660 KB | Output is correct |
66 | Correct | 58 ms | 117660 KB | Output is correct |
67 | Correct | 59 ms | 117640 KB | Output is correct |
68 | Correct | 63 ms | 117704 KB | Output is correct |
69 | Correct | 61 ms | 117664 KB | Output is correct |
70 | Correct | 68 ms | 117608 KB | Output is correct |
71 | Correct | 2691 ms | 119764 KB | Output is correct |
72 | Correct | 1252 ms | 119308 KB | Output is correct |
73 | Correct | 2485 ms | 119744 KB | Output is correct |
74 | Correct | 794 ms | 119116 KB | Output is correct |
75 | Correct | 1030 ms | 119092 KB | Output is correct |
76 | Execution timed out | 5056 ms | 120136 KB | Time limit exceeded |
77 | Halted | 0 ms | 0 KB | - |