답안 #943377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943377 2024-03-11T12:28:37 Z vjudge1 Toys (CEOI18_toy) C++17
100 / 100
2664 ms 90180 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector <int> v;
    for(int i=1;i*i<=n;i++){
        if(n%i==0){
            v.pb(i);
            if(i!=n/i)v.pb(n/i);
        }
    }
    sort(all(v));
    set <int> res;
    map <int,set <int> > sum;
    sum[1].insert(0);
    for(int i=0;i<v.size();i++){
        for(int j=0;j<i;j++){
            if(v[i]%v[j]==0){
                for(auto x : sum[v[j]])sum[v[i]].insert(x+v[i]/v[j]-1);
            }
        }
    }
    for(auto x : sum[n])res.insert(x);
    cout<<res.size()<<"\n";
    for(auto x : res)cout<<x<<" ";
    cout<<"\n";
    
}
/*
 
*/

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:24:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 604 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 4 ms 600 KB Output is correct
53 Correct 4 ms 604 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 4 ms 604 KB Output is correct
56 Correct 4 ms 604 KB Output is correct
57 Correct 4 ms 604 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 2 ms 600 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 2 ms 604 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 604 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 4 ms 600 KB Output is correct
53 Correct 4 ms 604 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 4 ms 604 KB Output is correct
56 Correct 4 ms 604 KB Output is correct
57 Correct 4 ms 604 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 2 ms 600 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 2 ms 604 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 375 ms 19408 KB Output is correct
72 Correct 236 ms 14796 KB Output is correct
73 Correct 379 ms 17320 KB Output is correct
74 Correct 190 ms 11860 KB Output is correct
75 Correct 206 ms 12428 KB Output is correct
76 Correct 602 ms 26108 KB Output is correct
77 Correct 501 ms 23260 KB Output is correct
78 Correct 442 ms 21596 KB Output is correct
79 Correct 446 ms 21060 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 2 ms 604 KB Output is correct
83 Correct 40 ms 3932 KB Output is correct
84 Correct 54 ms 4840 KB Output is correct
85 Correct 12 ms 1628 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 60 ms 5384 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 16 ms 2392 KB Output is correct
92 Correct 76 ms 6996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 600 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 604 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 4 ms 600 KB Output is correct
53 Correct 4 ms 604 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 4 ms 604 KB Output is correct
56 Correct 4 ms 604 KB Output is correct
57 Correct 4 ms 604 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 2 ms 600 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 2 ms 604 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 375 ms 19408 KB Output is correct
72 Correct 236 ms 14796 KB Output is correct
73 Correct 379 ms 17320 KB Output is correct
74 Correct 190 ms 11860 KB Output is correct
75 Correct 206 ms 12428 KB Output is correct
76 Correct 602 ms 26108 KB Output is correct
77 Correct 501 ms 23260 KB Output is correct
78 Correct 442 ms 21596 KB Output is correct
79 Correct 446 ms 21060 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 2 ms 604 KB Output is correct
83 Correct 40 ms 3932 KB Output is correct
84 Correct 54 ms 4840 KB Output is correct
85 Correct 12 ms 1628 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 60 ms 5384 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 16 ms 2392 KB Output is correct
92 Correct 76 ms 6996 KB Output is correct
93 Correct 2203 ms 80676 KB Output is correct
94 Correct 1207 ms 54860 KB Output is correct
95 Correct 1441 ms 57116 KB Output is correct
96 Correct 1260 ms 51072 KB Output is correct
97 Correct 1168 ms 46600 KB Output is correct
98 Correct 2645 ms 88900 KB Output is correct
99 Correct 2664 ms 90180 KB Output is correct
100 Correct 2534 ms 86708 KB Output is correct
101 Correct 2289 ms 80344 KB Output is correct
102 Correct 1993 ms 72492 KB Output is correct
103 Correct 1644 ms 65628 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 1 ms 348 KB Output is correct
106 Correct 6 ms 1116 KB Output is correct
107 Correct 144 ms 10292 KB Output is correct
108 Correct 373 ms 21840 KB Output is correct
109 Correct 30 ms 3664 KB Output is correct
110 Correct 1 ms 348 KB Output is correct
111 Correct 186 ms 13088 KB Output is correct
112 Correct 1 ms 348 KB Output is correct
113 Correct 1 ms 348 KB Output is correct
114 Correct 5 ms 1116 KB Output is correct
115 Correct 1 ms 348 KB Output is correct
116 Correct 11 ms 1820 KB Output is correct
117 Correct 394 ms 26244 KB Output is correct