제출 #1237191

#제출 시각아이디문제언어결과실행 시간메모리
1237191neisennToys (CEOI18_toy)C++20
100 / 100
1621 ms86664 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const char nl = '\n';
map<int, set<int>> mp;

void get(int n){
    if (mp[n].size()) return;
    mp[n].insert(n-1);
    for (int i = 2; i*i <= n; i++){
        if (n % i == 0){
            get(n/i);
            for (int c : mp[n/i]){
                mp[n].insert(i-1+c);
            }
        }
    }
}

void solve(){
    int n; cin >> n;
    get(n);
    cout << mp[n].size() << nl;
    for (int i : mp[n]){
        cout << i << ' ';
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1; // cin >> t;
    while (t--){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...