Submission #93397

# Submission time Handle Problem Language Result Execution time Memory
93397 2019-01-08T08:33:26 Z SpeedOfMagic Toys (CEOI18_toy) C++17
0 / 100
2 ms 376 KB
/** MIT License Copyright (c) 2018-2019(!) Vasilyev Daniil **/
#include <bits/stdc++.h>
using namespace std;
template<typename T> using v = vector<T>;
typedef long long longlong;
#define int longlong
typedef long double ld;
typedef string str;
typedef vector<int> vint;
#define rep(a, l, r) for(int a = (l); a < (r); a++)
#define pb push_back
#define fs first
#define sc second
#define sz(a) ((int) a.size())
const long long inf = 4611686018427387903; //2^62 - 1
#if 0  //FileIO
const string fileName = "";
ifstream fin ((fileName == "" ? "input.txt"  : fileName + ".in" ));
ofstream fout((fileName == "" ? "output.txt" : fileName + ".out"));
#define get fin>>
#define put fout<<
#else
#define get cin>>
#define put cout<<
#endif
#define eol put endl
void read() {} template<typename Arg,typename... Args> void read (Arg& arg,Args&... args){get (arg)     ;read(args...) ;}
void print(){} template<typename Arg,typename... Args> void print(Arg  arg,Args...  args){put (arg)<<" ";print(args...);}
int getInt(){int a; get a; return a;}
//code starts here
void run() {
    /*
    36 = 1 2 3 4 6 9 12 18 36
    dp[1] = {0}
    dp[2] = {1}
    dp[3] = {2}
    dp[4] = {3, 2}
    dp[6] = {5, 3}
    dp[9] = {8, 4}
    dp[12] = {11, 6, 5, 4}
    dp[18] = {17, }
    */
    int n;
    get n;
    if (n == 1) {put 0; return;}
    vint divs;
    rep(i, 1, ceil(sqrt(n)) + 1)
        if (n % i == 0) {
            divs.pb(i);
            if (n / i != i)
                divs.pb(n / i);
        }
    sort(divs.begin(), divs.end());
    int m = sz(divs);
    set<int> dp[m];
    dp[0] = {0};
    rep(i, 1, m)
        rep(j, 0, i)
            if (divs[i] % divs[j] == 0)
                for (int k : dp[j])
                    dp[i].insert(divs[i] / divs[j] - 1 + k);
    put sz(dp[m - 1]);
    eol;
    for (int i : dp[m - 1])
        print(i);
}
signed main() {srand(time(0)); ios::sync_with_stdio(0); cin.tie(0); put fixed << setprecision(12); run(); return 0;}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -