Submission #943018

# Submission time Handle Problem Language Result Execution time Memory
943018 2024-03-11T07:41:15 Z vjudge1 Toys (CEOI18_toy) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define int long long
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    unordered_map<int, unordered_map<int, int> > mp;
    vector<int> p;
    for(int i = 2; i * i <= n; i++){
        if(n%i != 0) continue;
            p.push_back(i); 
            if(n / i != i) p.push_back(n / i);
    }
    sort(all(p));
    function<void(int, int, int, int)> f=[&](int cur, int have, int sum, int last){
            if(cur > n) return;
            if(mp[cur].count(sum)) return;
            if(cur == n){
                mp[n][sum] = 1;
                return;
            }
            mp[cur][sum] = 1;
            for(int id = last; id < (int)p.size(); id++){
                int x = p[id];
                if((long long)(cur * x) > n) break;
                f(cur*x, have + 1, sum + x - 1, id);
            }
    };
    f(1, 0, 0, 0);
    vector<int> ans;
    for(auto x : mp[n]) ans.push_back(x.ff);
    ans.push_back(n-1);
    sort(all(ans));
    cout << ans.size() << '\n';
    for(auto x : ans) cout << x << ' ';
    
    
    
    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -