답안 #943373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943373 2024-03-11T12:26:11 Z Aiperiii Toys (CEOI18_toy) C++14
59 / 100
564 ms 262144 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,vector <int> > sum;
    sum[1].pb(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]].pb(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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 512 KB Output is correct
16 Correct 0 ms 348 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 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 440 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 512 KB Output is correct
16 Correct 0 ms 348 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 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 440 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 352 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 6 ms 2196 KB Output is correct
32 Correct 3 ms 1252 KB Output is correct
33 Correct 2 ms 992 KB Output is correct
34 Correct 1 ms 356 KB Output is correct
35 Correct 0 ms 360 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 2 ms 1056 KB Output is correct
38 Correct 1 ms 352 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 724 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 436 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 440 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 512 KB Output is correct
16 Correct 0 ms 348 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 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 440 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 352 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 6 ms 2196 KB Output is correct
32 Correct 3 ms 1252 KB Output is correct
33 Correct 2 ms 992 KB Output is correct
34 Correct 1 ms 356 KB Output is correct
35 Correct 0 ms 360 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 2 ms 1056 KB Output is correct
38 Correct 1 ms 352 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 724 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 436 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 440 KB Output is correct
50 Correct 20 ms 9164 KB Output is correct
51 Correct 15 ms 5024 KB Output is correct
52 Correct 29 ms 10704 KB Output is correct
53 Correct 23 ms 9544 KB Output is correct
54 Correct 4 ms 1556 KB Output is correct
55 Correct 87 ms 35332 KB Output is correct
56 Correct 113 ms 40956 KB Output is correct
57 Correct 41 ms 18044 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 2 ms 980 KB Output is correct
61 Correct 45 ms 20040 KB Output is correct
62 Correct 4 ms 1748 KB Output is correct
63 Correct 3 ms 1052 KB Output is correct
64 Correct 0 ms 436 KB Output is correct
65 Correct 12 ms 4628 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 2 ms 1116 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 512 KB Output is correct
16 Correct 0 ms 348 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 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 440 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 352 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 6 ms 2196 KB Output is correct
32 Correct 3 ms 1252 KB Output is correct
33 Correct 2 ms 992 KB Output is correct
34 Correct 1 ms 356 KB Output is correct
35 Correct 0 ms 360 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 2 ms 1056 KB Output is correct
38 Correct 1 ms 352 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 724 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 436 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 440 KB Output is correct
50 Correct 20 ms 9164 KB Output is correct
51 Correct 15 ms 5024 KB Output is correct
52 Correct 29 ms 10704 KB Output is correct
53 Correct 23 ms 9544 KB Output is correct
54 Correct 4 ms 1556 KB Output is correct
55 Correct 87 ms 35332 KB Output is correct
56 Correct 113 ms 40956 KB Output is correct
57 Correct 41 ms 18044 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 2 ms 980 KB Output is correct
61 Correct 45 ms 20040 KB Output is correct
62 Correct 4 ms 1748 KB Output is correct
63 Correct 3 ms 1052 KB Output is correct
64 Correct 0 ms 436 KB Output is correct
65 Correct 12 ms 4628 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 2 ms 1116 KB Output is correct
71 Runtime error 564 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 512 KB Output is correct
16 Correct 0 ms 348 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 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 440 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 860 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 352 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 6 ms 2196 KB Output is correct
32 Correct 3 ms 1252 KB Output is correct
33 Correct 2 ms 992 KB Output is correct
34 Correct 1 ms 356 KB Output is correct
35 Correct 0 ms 360 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 2 ms 1056 KB Output is correct
38 Correct 1 ms 352 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 724 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 436 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 440 KB Output is correct
50 Correct 20 ms 9164 KB Output is correct
51 Correct 15 ms 5024 KB Output is correct
52 Correct 29 ms 10704 KB Output is correct
53 Correct 23 ms 9544 KB Output is correct
54 Correct 4 ms 1556 KB Output is correct
55 Correct 87 ms 35332 KB Output is correct
56 Correct 113 ms 40956 KB Output is correct
57 Correct 41 ms 18044 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 2 ms 980 KB Output is correct
61 Correct 45 ms 20040 KB Output is correct
62 Correct 4 ms 1748 KB Output is correct
63 Correct 3 ms 1052 KB Output is correct
64 Correct 0 ms 436 KB Output is correct
65 Correct 12 ms 4628 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 2 ms 1116 KB Output is correct
71 Runtime error 564 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -