Submission #893533

# Submission time Handle Problem Language Result Execution time Memory
893533 2023-12-27T06:28:41 Z vjudge1 Toys (CEOI18_toy) C++17
59 / 100
155 ms 68688 KB
#include<bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define int ll
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mispertion ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define F first
#define S second
#define getlast(s) (*s.rbegin())
#define debg cout << "OK\n"

const ld PI = 3.1415926535;
const int N = 2e5 + 2;
const int M = 7e6 + 1;
int mod = 1e9+7;
const int infi = INT_MAX;
const ll infl = LLONG_MAX;
const int P = 31;

int mult(int a, int b) {
    return a * 1LL * b % mod;
}

int sum(int a, int b) {
    a %= mod; 
    if (a + b < 0)
        return a + b + mod;
    if (a + b >= mod)
        return a + b - mod;
    return a + b;
}

ll binpow(ll a, ll n) {
    if (n == 0)
        return 1;
    if (n % 2 == 1) {
        return binpow(a, n - 1) * a % mod;
    } else {
        ll b = binpow(a, n / 2);
        return b * b % mod;
    }
}

vector<int> ds[N];
int dp[N];
set<int> st;

void getans(int n, int cs = 0){
    if(n == 1){
        st.insert(cs);
        return;
    }
    for(auto d : ds[n]){
        getans(n / d, cs + d - 1);
    }
}

void solve(){
    int n;
    cin >> n;
    getans(n);
    cout << sz(st) << '\n';
    for(auto e : st)
        cout << e << ' ';
}   

signed main() {
    mispertion;
    for(int d = 2; d < N; d++){
        for(int i = d; i < N; i += d)
            ds[i].pb(d);
    }
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 114 ms 34148 KB Output is correct
2 Correct 110 ms 33980 KB Output is correct
3 Correct 105 ms 33876 KB Output is correct
4 Correct 109 ms 33908 KB Output is correct
5 Correct 109 ms 34124 KB Output is correct
6 Correct 107 ms 33876 KB Output is correct
7 Correct 109 ms 33884 KB Output is correct
8 Correct 109 ms 33820 KB Output is correct
9 Correct 109 ms 33888 KB Output is correct
10 Correct 113 ms 33888 KB Output is correct
11 Correct 109 ms 33980 KB Output is correct
12 Correct 109 ms 33964 KB Output is correct
13 Correct 110 ms 33728 KB Output is correct
14 Correct 107 ms 33888 KB Output is correct
15 Correct 106 ms 33788 KB Output is correct
16 Correct 104 ms 33872 KB Output is correct
17 Correct 106 ms 33872 KB Output is correct
18 Correct 112 ms 33872 KB Output is correct
19 Correct 105 ms 33872 KB Output is correct
20 Correct 103 ms 33920 KB Output is correct
21 Correct 106 ms 33824 KB Output is correct
22 Correct 107 ms 33964 KB Output is correct
23 Correct 111 ms 33952 KB Output is correct
24 Correct 108 ms 33776 KB Output is correct
25 Correct 105 ms 33888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 34148 KB Output is correct
2 Correct 110 ms 33980 KB Output is correct
3 Correct 105 ms 33876 KB Output is correct
4 Correct 109 ms 33908 KB Output is correct
5 Correct 109 ms 34124 KB Output is correct
6 Correct 107 ms 33876 KB Output is correct
7 Correct 109 ms 33884 KB Output is correct
8 Correct 109 ms 33820 KB Output is correct
9 Correct 109 ms 33888 KB Output is correct
10 Correct 113 ms 33888 KB Output is correct
11 Correct 109 ms 33980 KB Output is correct
12 Correct 109 ms 33964 KB Output is correct
13 Correct 110 ms 33728 KB Output is correct
14 Correct 107 ms 33888 KB Output is correct
15 Correct 106 ms 33788 KB Output is correct
16 Correct 104 ms 33872 KB Output is correct
17 Correct 106 ms 33872 KB Output is correct
18 Correct 112 ms 33872 KB Output is correct
19 Correct 105 ms 33872 KB Output is correct
20 Correct 103 ms 33920 KB Output is correct
21 Correct 106 ms 33824 KB Output is correct
22 Correct 107 ms 33964 KB Output is correct
23 Correct 111 ms 33952 KB Output is correct
24 Correct 108 ms 33776 KB Output is correct
25 Correct 105 ms 33888 KB Output is correct
26 Correct 116 ms 33760 KB Output is correct
27 Correct 105 ms 33880 KB Output is correct
28 Correct 104 ms 33836 KB Output is correct
29 Correct 109 ms 33888 KB Output is correct
30 Correct 118 ms 33888 KB Output is correct
31 Correct 112 ms 33824 KB Output is correct
32 Correct 107 ms 33820 KB Output is correct
33 Correct 105 ms 33948 KB Output is correct
34 Correct 121 ms 33876 KB Output is correct
35 Correct 107 ms 33876 KB Output is correct
36 Correct 105 ms 33876 KB Output is correct
37 Correct 106 ms 33936 KB Output is correct
38 Correct 111 ms 33776 KB Output is correct
39 Correct 106 ms 33940 KB Output is correct
40 Correct 105 ms 33872 KB Output is correct
41 Correct 105 ms 33876 KB Output is correct
42 Correct 112 ms 33872 KB Output is correct
43 Correct 105 ms 33872 KB Output is correct
44 Correct 111 ms 33880 KB Output is correct
45 Correct 104 ms 33872 KB Output is correct
46 Correct 108 ms 33872 KB Output is correct
47 Correct 111 ms 33752 KB Output is correct
48 Correct 106 ms 33968 KB Output is correct
49 Correct 106 ms 33936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 34148 KB Output is correct
2 Correct 110 ms 33980 KB Output is correct
3 Correct 105 ms 33876 KB Output is correct
4 Correct 109 ms 33908 KB Output is correct
5 Correct 109 ms 34124 KB Output is correct
6 Correct 107 ms 33876 KB Output is correct
7 Correct 109 ms 33884 KB Output is correct
8 Correct 109 ms 33820 KB Output is correct
9 Correct 109 ms 33888 KB Output is correct
10 Correct 113 ms 33888 KB Output is correct
11 Correct 109 ms 33980 KB Output is correct
12 Correct 109 ms 33964 KB Output is correct
13 Correct 110 ms 33728 KB Output is correct
14 Correct 107 ms 33888 KB Output is correct
15 Correct 106 ms 33788 KB Output is correct
16 Correct 104 ms 33872 KB Output is correct
17 Correct 106 ms 33872 KB Output is correct
18 Correct 112 ms 33872 KB Output is correct
19 Correct 105 ms 33872 KB Output is correct
20 Correct 103 ms 33920 KB Output is correct
21 Correct 106 ms 33824 KB Output is correct
22 Correct 107 ms 33964 KB Output is correct
23 Correct 111 ms 33952 KB Output is correct
24 Correct 108 ms 33776 KB Output is correct
25 Correct 105 ms 33888 KB Output is correct
26 Correct 116 ms 33760 KB Output is correct
27 Correct 105 ms 33880 KB Output is correct
28 Correct 104 ms 33836 KB Output is correct
29 Correct 109 ms 33888 KB Output is correct
30 Correct 118 ms 33888 KB Output is correct
31 Correct 112 ms 33824 KB Output is correct
32 Correct 107 ms 33820 KB Output is correct
33 Correct 105 ms 33948 KB Output is correct
34 Correct 121 ms 33876 KB Output is correct
35 Correct 107 ms 33876 KB Output is correct
36 Correct 105 ms 33876 KB Output is correct
37 Correct 106 ms 33936 KB Output is correct
38 Correct 111 ms 33776 KB Output is correct
39 Correct 106 ms 33940 KB Output is correct
40 Correct 105 ms 33872 KB Output is correct
41 Correct 105 ms 33876 KB Output is correct
42 Correct 112 ms 33872 KB Output is correct
43 Correct 105 ms 33872 KB Output is correct
44 Correct 111 ms 33880 KB Output is correct
45 Correct 104 ms 33872 KB Output is correct
46 Correct 108 ms 33872 KB Output is correct
47 Correct 111 ms 33752 KB Output is correct
48 Correct 106 ms 33968 KB Output is correct
49 Correct 106 ms 33936 KB Output is correct
50 Correct 114 ms 33892 KB Output is correct
51 Correct 127 ms 33944 KB Output is correct
52 Correct 120 ms 33936 KB Output is correct
53 Correct 117 ms 34076 KB Output is correct
54 Correct 110 ms 33876 KB Output is correct
55 Correct 155 ms 33972 KB Output is correct
56 Correct 155 ms 34004 KB Output is correct
57 Correct 136 ms 33960 KB Output is correct
58 Correct 107 ms 33740 KB Output is correct
59 Correct 107 ms 34128 KB Output is correct
60 Correct 106 ms 33820 KB Output is correct
61 Correct 138 ms 33996 KB Output is correct
62 Correct 108 ms 33872 KB Output is correct
63 Correct 116 ms 33752 KB Output is correct
64 Correct 109 ms 33816 KB Output is correct
65 Correct 115 ms 33948 KB Output is correct
66 Correct 107 ms 33972 KB Output is correct
67 Correct 132 ms 33864 KB Output is correct
68 Correct 108 ms 33724 KB Output is correct
69 Correct 117 ms 33868 KB Output is correct
70 Correct 108 ms 33988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 114 ms 34148 KB Output is correct
2 Correct 110 ms 33980 KB Output is correct
3 Correct 105 ms 33876 KB Output is correct
4 Correct 109 ms 33908 KB Output is correct
5 Correct 109 ms 34124 KB Output is correct
6 Correct 107 ms 33876 KB Output is correct
7 Correct 109 ms 33884 KB Output is correct
8 Correct 109 ms 33820 KB Output is correct
9 Correct 109 ms 33888 KB Output is correct
10 Correct 113 ms 33888 KB Output is correct
11 Correct 109 ms 33980 KB Output is correct
12 Correct 109 ms 33964 KB Output is correct
13 Correct 110 ms 33728 KB Output is correct
14 Correct 107 ms 33888 KB Output is correct
15 Correct 106 ms 33788 KB Output is correct
16 Correct 104 ms 33872 KB Output is correct
17 Correct 106 ms 33872 KB Output is correct
18 Correct 112 ms 33872 KB Output is correct
19 Correct 105 ms 33872 KB Output is correct
20 Correct 103 ms 33920 KB Output is correct
21 Correct 106 ms 33824 KB Output is correct
22 Correct 107 ms 33964 KB Output is correct
23 Correct 111 ms 33952 KB Output is correct
24 Correct 108 ms 33776 KB Output is correct
25 Correct 105 ms 33888 KB Output is correct
26 Correct 116 ms 33760 KB Output is correct
27 Correct 105 ms 33880 KB Output is correct
28 Correct 104 ms 33836 KB Output is correct
29 Correct 109 ms 33888 KB Output is correct
30 Correct 118 ms 33888 KB Output is correct
31 Correct 112 ms 33824 KB Output is correct
32 Correct 107 ms 33820 KB Output is correct
33 Correct 105 ms 33948 KB Output is correct
34 Correct 121 ms 33876 KB Output is correct
35 Correct 107 ms 33876 KB Output is correct
36 Correct 105 ms 33876 KB Output is correct
37 Correct 106 ms 33936 KB Output is correct
38 Correct 111 ms 33776 KB Output is correct
39 Correct 106 ms 33940 KB Output is correct
40 Correct 105 ms 33872 KB Output is correct
41 Correct 105 ms 33876 KB Output is correct
42 Correct 112 ms 33872 KB Output is correct
43 Correct 105 ms 33872 KB Output is correct
44 Correct 111 ms 33880 KB Output is correct
45 Correct 104 ms 33872 KB Output is correct
46 Correct 108 ms 33872 KB Output is correct
47 Correct 111 ms 33752 KB Output is correct
48 Correct 106 ms 33968 KB Output is correct
49 Correct 106 ms 33936 KB Output is correct
50 Correct 114 ms 33892 KB Output is correct
51 Correct 127 ms 33944 KB Output is correct
52 Correct 120 ms 33936 KB Output is correct
53 Correct 117 ms 34076 KB Output is correct
54 Correct 110 ms 33876 KB Output is correct
55 Correct 155 ms 33972 KB Output is correct
56 Correct 155 ms 34004 KB Output is correct
57 Correct 136 ms 33960 KB Output is correct
58 Correct 107 ms 33740 KB Output is correct
59 Correct 107 ms 34128 KB Output is correct
60 Correct 106 ms 33820 KB Output is correct
61 Correct 138 ms 33996 KB Output is correct
62 Correct 108 ms 33872 KB Output is correct
63 Correct 116 ms 33752 KB Output is correct
64 Correct 109 ms 33816 KB Output is correct
65 Correct 115 ms 33948 KB Output is correct
66 Correct 107 ms 33972 KB Output is correct
67 Correct 132 ms 33864 KB Output is correct
68 Correct 108 ms 33724 KB Output is correct
69 Correct 117 ms 33868 KB Output is correct
70 Correct 108 ms 33988 KB Output is correct
71 Runtime error 129 ms 68688 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 114 ms 34148 KB Output is correct
2 Correct 110 ms 33980 KB Output is correct
3 Correct 105 ms 33876 KB Output is correct
4 Correct 109 ms 33908 KB Output is correct
5 Correct 109 ms 34124 KB Output is correct
6 Correct 107 ms 33876 KB Output is correct
7 Correct 109 ms 33884 KB Output is correct
8 Correct 109 ms 33820 KB Output is correct
9 Correct 109 ms 33888 KB Output is correct
10 Correct 113 ms 33888 KB Output is correct
11 Correct 109 ms 33980 KB Output is correct
12 Correct 109 ms 33964 KB Output is correct
13 Correct 110 ms 33728 KB Output is correct
14 Correct 107 ms 33888 KB Output is correct
15 Correct 106 ms 33788 KB Output is correct
16 Correct 104 ms 33872 KB Output is correct
17 Correct 106 ms 33872 KB Output is correct
18 Correct 112 ms 33872 KB Output is correct
19 Correct 105 ms 33872 KB Output is correct
20 Correct 103 ms 33920 KB Output is correct
21 Correct 106 ms 33824 KB Output is correct
22 Correct 107 ms 33964 KB Output is correct
23 Correct 111 ms 33952 KB Output is correct
24 Correct 108 ms 33776 KB Output is correct
25 Correct 105 ms 33888 KB Output is correct
26 Correct 116 ms 33760 KB Output is correct
27 Correct 105 ms 33880 KB Output is correct
28 Correct 104 ms 33836 KB Output is correct
29 Correct 109 ms 33888 KB Output is correct
30 Correct 118 ms 33888 KB Output is correct
31 Correct 112 ms 33824 KB Output is correct
32 Correct 107 ms 33820 KB Output is correct
33 Correct 105 ms 33948 KB Output is correct
34 Correct 121 ms 33876 KB Output is correct
35 Correct 107 ms 33876 KB Output is correct
36 Correct 105 ms 33876 KB Output is correct
37 Correct 106 ms 33936 KB Output is correct
38 Correct 111 ms 33776 KB Output is correct
39 Correct 106 ms 33940 KB Output is correct
40 Correct 105 ms 33872 KB Output is correct
41 Correct 105 ms 33876 KB Output is correct
42 Correct 112 ms 33872 KB Output is correct
43 Correct 105 ms 33872 KB Output is correct
44 Correct 111 ms 33880 KB Output is correct
45 Correct 104 ms 33872 KB Output is correct
46 Correct 108 ms 33872 KB Output is correct
47 Correct 111 ms 33752 KB Output is correct
48 Correct 106 ms 33968 KB Output is correct
49 Correct 106 ms 33936 KB Output is correct
50 Correct 114 ms 33892 KB Output is correct
51 Correct 127 ms 33944 KB Output is correct
52 Correct 120 ms 33936 KB Output is correct
53 Correct 117 ms 34076 KB Output is correct
54 Correct 110 ms 33876 KB Output is correct
55 Correct 155 ms 33972 KB Output is correct
56 Correct 155 ms 34004 KB Output is correct
57 Correct 136 ms 33960 KB Output is correct
58 Correct 107 ms 33740 KB Output is correct
59 Correct 107 ms 34128 KB Output is correct
60 Correct 106 ms 33820 KB Output is correct
61 Correct 138 ms 33996 KB Output is correct
62 Correct 108 ms 33872 KB Output is correct
63 Correct 116 ms 33752 KB Output is correct
64 Correct 109 ms 33816 KB Output is correct
65 Correct 115 ms 33948 KB Output is correct
66 Correct 107 ms 33972 KB Output is correct
67 Correct 132 ms 33864 KB Output is correct
68 Correct 108 ms 33724 KB Output is correct
69 Correct 117 ms 33868 KB Output is correct
70 Correct 108 ms 33988 KB Output is correct
71 Runtime error 129 ms 68688 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -