Submission #537243

# Submission time Handle Problem Language Result Execution time Memory
537243 2022-03-14T19:55:28 Z perchuts Toys (CEOI18_toy) C++17
59 / 100
5000 ms 460 KB
#include <bits/stdc++.h>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }

set<int>res;
int n;

void test(int x, int sum){
    if(x==n){
        res.insert(sum);
        return;
    }else if(x>n)return;
    for(int i=1;i<=n/x;++i){
        if(n%x*(i+1)!=0)continue;
        test(x*(i+1),sum+i);
    }

}

int main(){_
    cin>>n;
    // int sq = sqrt(n)+1;
    // int tmp = n;
    // vector<int>factors;
    // for(int i=2;i<=sq;++i){
    //     while(tmp%i==0){
    //         factors.pb(i);
    //         tmp/=i;
    //     }
    // }    
    // if(tmp!=1)factors.pb(tmp);
    test(1,0);
    cout<<sz(res)<<endl;
    for(auto x:res)cout<<x<<" ";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 320 KB Output is correct
26 Correct 11 ms 212 KB Output is correct
27 Correct 8 ms 212 KB Output is correct
28 Correct 3 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 21 ms 212 KB Output is correct
32 Correct 12 ms 212 KB Output is correct
33 Correct 11 ms 324 KB Output is correct
34 Correct 2 ms 324 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 4 ms 212 KB Output is correct
37 Correct 10 ms 332 KB Output is correct
38 Correct 5 ms 212 KB Output is correct
39 Correct 2 ms 316 KB Output is correct
40 Correct 10 ms 212 KB Output is correct
41 Correct 2 ms 212 KB Output is correct
42 Correct 2 ms 212 KB Output is correct
43 Correct 3 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 6 ms 212 KB Output is correct
46 Correct 3 ms 324 KB Output is correct
47 Correct 10 ms 324 KB Output is correct
48 Correct 2 ms 212 KB Output is correct
49 Correct 7 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 320 KB Output is correct
26 Correct 11 ms 212 KB Output is correct
27 Correct 8 ms 212 KB Output is correct
28 Correct 3 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 21 ms 212 KB Output is correct
32 Correct 12 ms 212 KB Output is correct
33 Correct 11 ms 324 KB Output is correct
34 Correct 2 ms 324 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 4 ms 212 KB Output is correct
37 Correct 10 ms 332 KB Output is correct
38 Correct 5 ms 212 KB Output is correct
39 Correct 2 ms 316 KB Output is correct
40 Correct 10 ms 212 KB Output is correct
41 Correct 2 ms 212 KB Output is correct
42 Correct 2 ms 212 KB Output is correct
43 Correct 3 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 6 ms 212 KB Output is correct
46 Correct 3 ms 324 KB Output is correct
47 Correct 10 ms 324 KB Output is correct
48 Correct 2 ms 212 KB Output is correct
49 Correct 7 ms 212 KB Output is correct
50 Correct 304 ms 312 KB Output is correct
51 Correct 189 ms 332 KB Output is correct
52 Correct 226 ms 444 KB Output is correct
53 Correct 177 ms 320 KB Output is correct
54 Correct 57 ms 212 KB Output is correct
55 Correct 592 ms 460 KB Output is correct
56 Correct 569 ms 456 KB Output is correct
57 Correct 409 ms 440 KB Output is correct
58 Correct 16 ms 212 KB Output is correct
59 Correct 17 ms 212 KB Output is correct
60 Correct 43 ms 320 KB Output is correct
61 Correct 370 ms 320 KB Output is correct
62 Correct 49 ms 212 KB Output is correct
63 Correct 87 ms 432 KB Output is correct
64 Correct 25 ms 212 KB Output is correct
65 Correct 265 ms 328 KB Output is correct
66 Correct 22 ms 212 KB Output is correct
67 Correct 16 ms 212 KB Output is correct
68 Correct 52 ms 304 KB Output is correct
69 Correct 67 ms 340 KB Output is correct
70 Correct 106 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 320 KB Output is correct
26 Correct 11 ms 212 KB Output is correct
27 Correct 8 ms 212 KB Output is correct
28 Correct 3 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 21 ms 212 KB Output is correct
32 Correct 12 ms 212 KB Output is correct
33 Correct 11 ms 324 KB Output is correct
34 Correct 2 ms 324 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 4 ms 212 KB Output is correct
37 Correct 10 ms 332 KB Output is correct
38 Correct 5 ms 212 KB Output is correct
39 Correct 2 ms 316 KB Output is correct
40 Correct 10 ms 212 KB Output is correct
41 Correct 2 ms 212 KB Output is correct
42 Correct 2 ms 212 KB Output is correct
43 Correct 3 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 6 ms 212 KB Output is correct
46 Correct 3 ms 324 KB Output is correct
47 Correct 10 ms 324 KB Output is correct
48 Correct 2 ms 212 KB Output is correct
49 Correct 7 ms 212 KB Output is correct
50 Correct 304 ms 312 KB Output is correct
51 Correct 189 ms 332 KB Output is correct
52 Correct 226 ms 444 KB Output is correct
53 Correct 177 ms 320 KB Output is correct
54 Correct 57 ms 212 KB Output is correct
55 Correct 592 ms 460 KB Output is correct
56 Correct 569 ms 456 KB Output is correct
57 Correct 409 ms 440 KB Output is correct
58 Correct 16 ms 212 KB Output is correct
59 Correct 17 ms 212 KB Output is correct
60 Correct 43 ms 320 KB Output is correct
61 Correct 370 ms 320 KB Output is correct
62 Correct 49 ms 212 KB Output is correct
63 Correct 87 ms 432 KB Output is correct
64 Correct 25 ms 212 KB Output is correct
65 Correct 265 ms 328 KB Output is correct
66 Correct 22 ms 212 KB Output is correct
67 Correct 16 ms 212 KB Output is correct
68 Correct 52 ms 304 KB Output is correct
69 Correct 67 ms 340 KB Output is correct
70 Correct 106 ms 212 KB Output is correct
71 Execution timed out 5038 ms 364 KB Time limit exceeded
72 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 216 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 324 KB Output is correct
25 Correct 0 ms 320 KB Output is correct
26 Correct 11 ms 212 KB Output is correct
27 Correct 8 ms 212 KB Output is correct
28 Correct 3 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 21 ms 212 KB Output is correct
32 Correct 12 ms 212 KB Output is correct
33 Correct 11 ms 324 KB Output is correct
34 Correct 2 ms 324 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 4 ms 212 KB Output is correct
37 Correct 10 ms 332 KB Output is correct
38 Correct 5 ms 212 KB Output is correct
39 Correct 2 ms 316 KB Output is correct
40 Correct 10 ms 212 KB Output is correct
41 Correct 2 ms 212 KB Output is correct
42 Correct 2 ms 212 KB Output is correct
43 Correct 3 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 6 ms 212 KB Output is correct
46 Correct 3 ms 324 KB Output is correct
47 Correct 10 ms 324 KB Output is correct
48 Correct 2 ms 212 KB Output is correct
49 Correct 7 ms 212 KB Output is correct
50 Correct 304 ms 312 KB Output is correct
51 Correct 189 ms 332 KB Output is correct
52 Correct 226 ms 444 KB Output is correct
53 Correct 177 ms 320 KB Output is correct
54 Correct 57 ms 212 KB Output is correct
55 Correct 592 ms 460 KB Output is correct
56 Correct 569 ms 456 KB Output is correct
57 Correct 409 ms 440 KB Output is correct
58 Correct 16 ms 212 KB Output is correct
59 Correct 17 ms 212 KB Output is correct
60 Correct 43 ms 320 KB Output is correct
61 Correct 370 ms 320 KB Output is correct
62 Correct 49 ms 212 KB Output is correct
63 Correct 87 ms 432 KB Output is correct
64 Correct 25 ms 212 KB Output is correct
65 Correct 265 ms 328 KB Output is correct
66 Correct 22 ms 212 KB Output is correct
67 Correct 16 ms 212 KB Output is correct
68 Correct 52 ms 304 KB Output is correct
69 Correct 67 ms 340 KB Output is correct
70 Correct 106 ms 212 KB Output is correct
71 Execution timed out 5038 ms 364 KB Time limit exceeded
72 Halted 0 ms 0 KB -