#include<bits/stdc++.h>
#define MAXN 1007
using namespace std;
int n;
vector<int> dels;
unordered_set<int> sums[MAXN][MAXN];
unordered_map<int,int> pos;
unordered_set<int> res;
vector<int> ans;
unordered_set<int> ff(int d,int mins){
if(mins>d)return {dels[d]-1};
if(!sums[d][mins].empty())return sums[d][mins];
sums[d][mins] = ff(d,mins+1);
if(dels[d]%dels[mins]==0){
unordered_set<int> s=ff(pos[dels[d]/dels[mins]],mins);
for(int i:s){
sums[d][mins].insert(i+dels[mins]-1);
}
}
return sums[d][mins];
}
int main(){
cin>>n;
for(int i=1;i*i<=n;i++){
if(n%i!=0)continue;
dels.push_back(i);
if(i!=n/i)dels.push_back(n/i);
}
sort(dels.begin(),dels.end());
for(int i=0;i<dels.size();i++){
pos[dels[i]]=i;
}
if(dels.size()>1000)cout<<1/0;
res=ff(dels.size()-1,1);
for(int i:res)ans.push_back(i);
sort(ans.begin(),ans.end());
cout<<ans.size()<<"\n";
for(int i:ans){
cout<<i<<" ";
}
cout<<"\n";
return 0;
}
Compilation message
toy.cpp: In function 'int main()':
toy.cpp:43:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int i=0;i<dels.size();i++){
| ~^~~~~~~~~~~~
toy.cpp:47:29: warning: division by zero [-Wdiv-by-zero]
47 | if(dels.size()>1000)cout<<1/0;
| ~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
55900 KB |
Output is correct |
2 |
Correct |
24 ms |
55900 KB |
Output is correct |
3 |
Correct |
26 ms |
55976 KB |
Output is correct |
4 |
Correct |
24 ms |
55900 KB |
Output is correct |
5 |
Correct |
25 ms |
55896 KB |
Output is correct |
6 |
Correct |
27 ms |
55996 KB |
Output is correct |
7 |
Correct |
21 ms |
55840 KB |
Output is correct |
8 |
Correct |
21 ms |
55824 KB |
Output is correct |
9 |
Correct |
22 ms |
55896 KB |
Output is correct |
10 |
Correct |
22 ms |
55900 KB |
Output is correct |
11 |
Correct |
24 ms |
55840 KB |
Output is correct |
12 |
Correct |
21 ms |
55900 KB |
Output is correct |
13 |
Correct |
21 ms |
55896 KB |
Output is correct |
14 |
Correct |
22 ms |
55920 KB |
Output is correct |
15 |
Correct |
22 ms |
55900 KB |
Output is correct |
16 |
Correct |
21 ms |
55900 KB |
Output is correct |
17 |
Correct |
21 ms |
55900 KB |
Output is correct |
18 |
Correct |
21 ms |
55788 KB |
Output is correct |
19 |
Correct |
21 ms |
55900 KB |
Output is correct |
20 |
Correct |
22 ms |
55896 KB |
Output is correct |
21 |
Correct |
23 ms |
55896 KB |
Output is correct |
22 |
Correct |
21 ms |
55900 KB |
Output is correct |
23 |
Correct |
21 ms |
56152 KB |
Output is correct |
24 |
Correct |
21 ms |
56000 KB |
Output is correct |
25 |
Correct |
22 ms |
55900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
55900 KB |
Output is correct |
2 |
Correct |
24 ms |
55900 KB |
Output is correct |
3 |
Correct |
26 ms |
55976 KB |
Output is correct |
4 |
Correct |
24 ms |
55900 KB |
Output is correct |
5 |
Correct |
25 ms |
55896 KB |
Output is correct |
6 |
Correct |
27 ms |
55996 KB |
Output is correct |
7 |
Correct |
21 ms |
55840 KB |
Output is correct |
8 |
Correct |
21 ms |
55824 KB |
Output is correct |
9 |
Correct |
22 ms |
55896 KB |
Output is correct |
10 |
Correct |
22 ms |
55900 KB |
Output is correct |
11 |
Correct |
24 ms |
55840 KB |
Output is correct |
12 |
Correct |
21 ms |
55900 KB |
Output is correct |
13 |
Correct |
21 ms |
55896 KB |
Output is correct |
14 |
Correct |
22 ms |
55920 KB |
Output is correct |
15 |
Correct |
22 ms |
55900 KB |
Output is correct |
16 |
Correct |
21 ms |
55900 KB |
Output is correct |
17 |
Correct |
21 ms |
55900 KB |
Output is correct |
18 |
Correct |
21 ms |
55788 KB |
Output is correct |
19 |
Correct |
21 ms |
55900 KB |
Output is correct |
20 |
Correct |
22 ms |
55896 KB |
Output is correct |
21 |
Correct |
23 ms |
55896 KB |
Output is correct |
22 |
Correct |
21 ms |
55900 KB |
Output is correct |
23 |
Correct |
21 ms |
56152 KB |
Output is correct |
24 |
Correct |
21 ms |
56000 KB |
Output is correct |
25 |
Correct |
22 ms |
55900 KB |
Output is correct |
26 |
Correct |
23 ms |
56668 KB |
Output is correct |
27 |
Correct |
24 ms |
56412 KB |
Output is correct |
28 |
Correct |
22 ms |
56156 KB |
Output is correct |
29 |
Correct |
22 ms |
56196 KB |
Output is correct |
30 |
Correct |
22 ms |
56064 KB |
Output is correct |
31 |
Correct |
22 ms |
56668 KB |
Output is correct |
32 |
Correct |
26 ms |
56408 KB |
Output is correct |
33 |
Correct |
29 ms |
56408 KB |
Output is correct |
34 |
Correct |
25 ms |
55900 KB |
Output is correct |
35 |
Correct |
26 ms |
56008 KB |
Output is correct |
36 |
Correct |
29 ms |
56152 KB |
Output is correct |
37 |
Correct |
25 ms |
56156 KB |
Output is correct |
38 |
Correct |
25 ms |
56024 KB |
Output is correct |
39 |
Correct |
25 ms |
55900 KB |
Output is correct |
40 |
Correct |
23 ms |
56412 KB |
Output is correct |
41 |
Correct |
24 ms |
55788 KB |
Output is correct |
42 |
Correct |
25 ms |
55896 KB |
Output is correct |
43 |
Correct |
24 ms |
55900 KB |
Output is correct |
44 |
Correct |
24 ms |
55900 KB |
Output is correct |
45 |
Correct |
25 ms |
55900 KB |
Output is correct |
46 |
Correct |
23 ms |
56152 KB |
Output is correct |
47 |
Correct |
24 ms |
56156 KB |
Output is correct |
48 |
Correct |
25 ms |
55896 KB |
Output is correct |
49 |
Correct |
24 ms |
55900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
55900 KB |
Output is correct |
2 |
Correct |
24 ms |
55900 KB |
Output is correct |
3 |
Correct |
26 ms |
55976 KB |
Output is correct |
4 |
Correct |
24 ms |
55900 KB |
Output is correct |
5 |
Correct |
25 ms |
55896 KB |
Output is correct |
6 |
Correct |
27 ms |
55996 KB |
Output is correct |
7 |
Correct |
21 ms |
55840 KB |
Output is correct |
8 |
Correct |
21 ms |
55824 KB |
Output is correct |
9 |
Correct |
22 ms |
55896 KB |
Output is correct |
10 |
Correct |
22 ms |
55900 KB |
Output is correct |
11 |
Correct |
24 ms |
55840 KB |
Output is correct |
12 |
Correct |
21 ms |
55900 KB |
Output is correct |
13 |
Correct |
21 ms |
55896 KB |
Output is correct |
14 |
Correct |
22 ms |
55920 KB |
Output is correct |
15 |
Correct |
22 ms |
55900 KB |
Output is correct |
16 |
Correct |
21 ms |
55900 KB |
Output is correct |
17 |
Correct |
21 ms |
55900 KB |
Output is correct |
18 |
Correct |
21 ms |
55788 KB |
Output is correct |
19 |
Correct |
21 ms |
55900 KB |
Output is correct |
20 |
Correct |
22 ms |
55896 KB |
Output is correct |
21 |
Correct |
23 ms |
55896 KB |
Output is correct |
22 |
Correct |
21 ms |
55900 KB |
Output is correct |
23 |
Correct |
21 ms |
56152 KB |
Output is correct |
24 |
Correct |
21 ms |
56000 KB |
Output is correct |
25 |
Correct |
22 ms |
55900 KB |
Output is correct |
26 |
Correct |
23 ms |
56668 KB |
Output is correct |
27 |
Correct |
24 ms |
56412 KB |
Output is correct |
28 |
Correct |
22 ms |
56156 KB |
Output is correct |
29 |
Correct |
22 ms |
56196 KB |
Output is correct |
30 |
Correct |
22 ms |
56064 KB |
Output is correct |
31 |
Correct |
22 ms |
56668 KB |
Output is correct |
32 |
Correct |
26 ms |
56408 KB |
Output is correct |
33 |
Correct |
29 ms |
56408 KB |
Output is correct |
34 |
Correct |
25 ms |
55900 KB |
Output is correct |
35 |
Correct |
26 ms |
56008 KB |
Output is correct |
36 |
Correct |
29 ms |
56152 KB |
Output is correct |
37 |
Correct |
25 ms |
56156 KB |
Output is correct |
38 |
Correct |
25 ms |
56024 KB |
Output is correct |
39 |
Correct |
25 ms |
55900 KB |
Output is correct |
40 |
Correct |
23 ms |
56412 KB |
Output is correct |
41 |
Correct |
24 ms |
55788 KB |
Output is correct |
42 |
Correct |
25 ms |
55896 KB |
Output is correct |
43 |
Correct |
24 ms |
55900 KB |
Output is correct |
44 |
Correct |
24 ms |
55900 KB |
Output is correct |
45 |
Correct |
25 ms |
55900 KB |
Output is correct |
46 |
Correct |
23 ms |
56152 KB |
Output is correct |
47 |
Correct |
24 ms |
56156 KB |
Output is correct |
48 |
Correct |
25 ms |
55896 KB |
Output is correct |
49 |
Correct |
24 ms |
55900 KB |
Output is correct |
50 |
Correct |
31 ms |
60508 KB |
Output is correct |
51 |
Correct |
30 ms |
59736 KB |
Output is correct |
52 |
Correct |
30 ms |
59440 KB |
Output is correct |
53 |
Correct |
29 ms |
58708 KB |
Output is correct |
54 |
Correct |
28 ms |
57692 KB |
Output is correct |
55 |
Correct |
30 ms |
61016 KB |
Output is correct |
56 |
Correct |
31 ms |
59996 KB |
Output is correct |
57 |
Correct |
32 ms |
60508 KB |
Output is correct |
58 |
Correct |
24 ms |
55868 KB |
Output is correct |
59 |
Correct |
22 ms |
55900 KB |
Output is correct |
60 |
Correct |
25 ms |
55896 KB |
Output is correct |
61 |
Correct |
27 ms |
57172 KB |
Output is correct |
62 |
Correct |
29 ms |
56924 KB |
Output is correct |
63 |
Correct |
25 ms |
56156 KB |
Output is correct |
64 |
Correct |
24 ms |
55760 KB |
Output is correct |
65 |
Correct |
27 ms |
57692 KB |
Output is correct |
66 |
Correct |
25 ms |
55900 KB |
Output is correct |
67 |
Correct |
25 ms |
55900 KB |
Output is correct |
68 |
Correct |
26 ms |
55896 KB |
Output is correct |
69 |
Correct |
24 ms |
56152 KB |
Output is correct |
70 |
Correct |
27 ms |
57428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
55900 KB |
Output is correct |
2 |
Correct |
24 ms |
55900 KB |
Output is correct |
3 |
Correct |
26 ms |
55976 KB |
Output is correct |
4 |
Correct |
24 ms |
55900 KB |
Output is correct |
5 |
Correct |
25 ms |
55896 KB |
Output is correct |
6 |
Correct |
27 ms |
55996 KB |
Output is correct |
7 |
Correct |
21 ms |
55840 KB |
Output is correct |
8 |
Correct |
21 ms |
55824 KB |
Output is correct |
9 |
Correct |
22 ms |
55896 KB |
Output is correct |
10 |
Correct |
22 ms |
55900 KB |
Output is correct |
11 |
Correct |
24 ms |
55840 KB |
Output is correct |
12 |
Correct |
21 ms |
55900 KB |
Output is correct |
13 |
Correct |
21 ms |
55896 KB |
Output is correct |
14 |
Correct |
22 ms |
55920 KB |
Output is correct |
15 |
Correct |
22 ms |
55900 KB |
Output is correct |
16 |
Correct |
21 ms |
55900 KB |
Output is correct |
17 |
Correct |
21 ms |
55900 KB |
Output is correct |
18 |
Correct |
21 ms |
55788 KB |
Output is correct |
19 |
Correct |
21 ms |
55900 KB |
Output is correct |
20 |
Correct |
22 ms |
55896 KB |
Output is correct |
21 |
Correct |
23 ms |
55896 KB |
Output is correct |
22 |
Correct |
21 ms |
55900 KB |
Output is correct |
23 |
Correct |
21 ms |
56152 KB |
Output is correct |
24 |
Correct |
21 ms |
56000 KB |
Output is correct |
25 |
Correct |
22 ms |
55900 KB |
Output is correct |
26 |
Correct |
23 ms |
56668 KB |
Output is correct |
27 |
Correct |
24 ms |
56412 KB |
Output is correct |
28 |
Correct |
22 ms |
56156 KB |
Output is correct |
29 |
Correct |
22 ms |
56196 KB |
Output is correct |
30 |
Correct |
22 ms |
56064 KB |
Output is correct |
31 |
Correct |
22 ms |
56668 KB |
Output is correct |
32 |
Correct |
26 ms |
56408 KB |
Output is correct |
33 |
Correct |
29 ms |
56408 KB |
Output is correct |
34 |
Correct |
25 ms |
55900 KB |
Output is correct |
35 |
Correct |
26 ms |
56008 KB |
Output is correct |
36 |
Correct |
29 ms |
56152 KB |
Output is correct |
37 |
Correct |
25 ms |
56156 KB |
Output is correct |
38 |
Correct |
25 ms |
56024 KB |
Output is correct |
39 |
Correct |
25 ms |
55900 KB |
Output is correct |
40 |
Correct |
23 ms |
56412 KB |
Output is correct |
41 |
Correct |
24 ms |
55788 KB |
Output is correct |
42 |
Correct |
25 ms |
55896 KB |
Output is correct |
43 |
Correct |
24 ms |
55900 KB |
Output is correct |
44 |
Correct |
24 ms |
55900 KB |
Output is correct |
45 |
Correct |
25 ms |
55900 KB |
Output is correct |
46 |
Correct |
23 ms |
56152 KB |
Output is correct |
47 |
Correct |
24 ms |
56156 KB |
Output is correct |
48 |
Correct |
25 ms |
55896 KB |
Output is correct |
49 |
Correct |
24 ms |
55900 KB |
Output is correct |
50 |
Correct |
31 ms |
60508 KB |
Output is correct |
51 |
Correct |
30 ms |
59736 KB |
Output is correct |
52 |
Correct |
30 ms |
59440 KB |
Output is correct |
53 |
Correct |
29 ms |
58708 KB |
Output is correct |
54 |
Correct |
28 ms |
57692 KB |
Output is correct |
55 |
Correct |
30 ms |
61016 KB |
Output is correct |
56 |
Correct |
31 ms |
59996 KB |
Output is correct |
57 |
Correct |
32 ms |
60508 KB |
Output is correct |
58 |
Correct |
24 ms |
55868 KB |
Output is correct |
59 |
Correct |
22 ms |
55900 KB |
Output is correct |
60 |
Correct |
25 ms |
55896 KB |
Output is correct |
61 |
Correct |
27 ms |
57172 KB |
Output is correct |
62 |
Correct |
29 ms |
56924 KB |
Output is correct |
63 |
Correct |
25 ms |
56156 KB |
Output is correct |
64 |
Correct |
24 ms |
55760 KB |
Output is correct |
65 |
Correct |
27 ms |
57692 KB |
Output is correct |
66 |
Correct |
25 ms |
55900 KB |
Output is correct |
67 |
Correct |
25 ms |
55900 KB |
Output is correct |
68 |
Correct |
26 ms |
55896 KB |
Output is correct |
69 |
Correct |
24 ms |
56152 KB |
Output is correct |
70 |
Correct |
27 ms |
57428 KB |
Output is correct |
71 |
Runtime error |
209 ms |
262144 KB |
Execution killed with signal 9 |
72 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
55900 KB |
Output is correct |
2 |
Correct |
24 ms |
55900 KB |
Output is correct |
3 |
Correct |
26 ms |
55976 KB |
Output is correct |
4 |
Correct |
24 ms |
55900 KB |
Output is correct |
5 |
Correct |
25 ms |
55896 KB |
Output is correct |
6 |
Correct |
27 ms |
55996 KB |
Output is correct |
7 |
Correct |
21 ms |
55840 KB |
Output is correct |
8 |
Correct |
21 ms |
55824 KB |
Output is correct |
9 |
Correct |
22 ms |
55896 KB |
Output is correct |
10 |
Correct |
22 ms |
55900 KB |
Output is correct |
11 |
Correct |
24 ms |
55840 KB |
Output is correct |
12 |
Correct |
21 ms |
55900 KB |
Output is correct |
13 |
Correct |
21 ms |
55896 KB |
Output is correct |
14 |
Correct |
22 ms |
55920 KB |
Output is correct |
15 |
Correct |
22 ms |
55900 KB |
Output is correct |
16 |
Correct |
21 ms |
55900 KB |
Output is correct |
17 |
Correct |
21 ms |
55900 KB |
Output is correct |
18 |
Correct |
21 ms |
55788 KB |
Output is correct |
19 |
Correct |
21 ms |
55900 KB |
Output is correct |
20 |
Correct |
22 ms |
55896 KB |
Output is correct |
21 |
Correct |
23 ms |
55896 KB |
Output is correct |
22 |
Correct |
21 ms |
55900 KB |
Output is correct |
23 |
Correct |
21 ms |
56152 KB |
Output is correct |
24 |
Correct |
21 ms |
56000 KB |
Output is correct |
25 |
Correct |
22 ms |
55900 KB |
Output is correct |
26 |
Correct |
23 ms |
56668 KB |
Output is correct |
27 |
Correct |
24 ms |
56412 KB |
Output is correct |
28 |
Correct |
22 ms |
56156 KB |
Output is correct |
29 |
Correct |
22 ms |
56196 KB |
Output is correct |
30 |
Correct |
22 ms |
56064 KB |
Output is correct |
31 |
Correct |
22 ms |
56668 KB |
Output is correct |
32 |
Correct |
26 ms |
56408 KB |
Output is correct |
33 |
Correct |
29 ms |
56408 KB |
Output is correct |
34 |
Correct |
25 ms |
55900 KB |
Output is correct |
35 |
Correct |
26 ms |
56008 KB |
Output is correct |
36 |
Correct |
29 ms |
56152 KB |
Output is correct |
37 |
Correct |
25 ms |
56156 KB |
Output is correct |
38 |
Correct |
25 ms |
56024 KB |
Output is correct |
39 |
Correct |
25 ms |
55900 KB |
Output is correct |
40 |
Correct |
23 ms |
56412 KB |
Output is correct |
41 |
Correct |
24 ms |
55788 KB |
Output is correct |
42 |
Correct |
25 ms |
55896 KB |
Output is correct |
43 |
Correct |
24 ms |
55900 KB |
Output is correct |
44 |
Correct |
24 ms |
55900 KB |
Output is correct |
45 |
Correct |
25 ms |
55900 KB |
Output is correct |
46 |
Correct |
23 ms |
56152 KB |
Output is correct |
47 |
Correct |
24 ms |
56156 KB |
Output is correct |
48 |
Correct |
25 ms |
55896 KB |
Output is correct |
49 |
Correct |
24 ms |
55900 KB |
Output is correct |
50 |
Correct |
31 ms |
60508 KB |
Output is correct |
51 |
Correct |
30 ms |
59736 KB |
Output is correct |
52 |
Correct |
30 ms |
59440 KB |
Output is correct |
53 |
Correct |
29 ms |
58708 KB |
Output is correct |
54 |
Correct |
28 ms |
57692 KB |
Output is correct |
55 |
Correct |
30 ms |
61016 KB |
Output is correct |
56 |
Correct |
31 ms |
59996 KB |
Output is correct |
57 |
Correct |
32 ms |
60508 KB |
Output is correct |
58 |
Correct |
24 ms |
55868 KB |
Output is correct |
59 |
Correct |
22 ms |
55900 KB |
Output is correct |
60 |
Correct |
25 ms |
55896 KB |
Output is correct |
61 |
Correct |
27 ms |
57172 KB |
Output is correct |
62 |
Correct |
29 ms |
56924 KB |
Output is correct |
63 |
Correct |
25 ms |
56156 KB |
Output is correct |
64 |
Correct |
24 ms |
55760 KB |
Output is correct |
65 |
Correct |
27 ms |
57692 KB |
Output is correct |
66 |
Correct |
25 ms |
55900 KB |
Output is correct |
67 |
Correct |
25 ms |
55900 KB |
Output is correct |
68 |
Correct |
26 ms |
55896 KB |
Output is correct |
69 |
Correct |
24 ms |
56152 KB |
Output is correct |
70 |
Correct |
27 ms |
57428 KB |
Output is correct |
71 |
Runtime error |
209 ms |
262144 KB |
Execution killed with signal 9 |
72 |
Halted |
0 ms |
0 KB |
- |