This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
signed main(){
int n;
cin>>n;
vector<int> d;
for (int i=1;i * i<=n;i++){
if (n % i == 0){
d.push_back(i);
d.push_back(n / i);
}
}
sort(begin(d),end(d));
int k = d.size();
set<pair<int,int>> P;
set<int> s;
P.insert({0,1});
for (int i=1;i<k;i++){
for (auto [l,j] : P){
if (1LL * j * d[i] > 1LL * n)
continue;
P.insert({l + d[i] - 1,j * d[i]});
if (1LL * j * d[i] == 1LL * n)
s.insert(l + d[i] - 1);
}
}
printf("%d\n",(int)s.size());
for (int i : s)
printf("%d ",i);
printf("\n");
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |