Submission #464296

# Submission time Handle Problem Language Result Execution time Memory
464296 2021-08-12T18:30:06 Z osmanallazov Toys (CEOI18_toy) C++14
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define szof(x) ((int)(x).size())
#define vi vector<int>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define mkp make_pair
const int INF = 2147483647;
const int LNF = INF*INF;
const int MOD = 1000000007;
const int mod = 998244353;
int n;
vi dv;
vector<set<int>> dp;
signed main(){
    cin>>n;
 
    for(int i=1; i*i<=n; i++){
        if(n % i == 0){
            dv.pb(i);
            if(i * i < n) dv.pb(n / i);
        }
    }
 
    sort(dv.begin(), dv.end());
 
    int C =szof(dv);
    dp.resize(C);
    dp[0].insert(0);
    for(int i=1;i<C-1;i++){
        for(int j=0;j<i-1;j++){
 
            if(dv[i] % dv[j] != 0) continue;
            int mt = dv[i] / dv[j];
            for(int k : dp[j]){
                dp[i].insert(k + mt - 1);
            }
 
        }
    }
 
    cout<<szof(dp[C-1])<<'\n';
    for(int i : dp[C-1]){
        cout<<i<<" ";
    }
    cout<<'\n';
 
    return 0;
 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -