# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920765 | Sir_Ahmed_Imran | Toys (CEOI18_toy) | C++17 | 2009 ms | 86688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define add insert
#define ll long long
#define append push_back
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define N 2001
map<int,set<int>> x;
void compute(int n){
int m=sqrtl(n);
x[n].add(n-1);
for(int i=2;i<=m;i++){
if(n%i) continue;
for(auto& j:x[n/i])
x[n].add(j+i-1);
}
}
void solve(){
int n,m,o,p,q,r;
cin>>n;
m=sqrtl(n);
vector<int> v;
for(int i=2;i<=m;i++){
if(n%i) continue;
v.append(n/i);
v.append(i);
}
sort(all(v));
for(auto& i:v)
compute(i);
compute(n);
cout<<x[n].size()<<nl;
for(auto& i:x[n])
cout<<i<<' ';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
Compilation message (stderr)
# | 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... |