# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
70771 |
2018-08-23T10:31:45 Z |
Diuven |
Toys (CEOI18_toy) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n;
vector<int> V, D[200010];
map<int, int> cnt;
void init(){
for(int i=1; i*i<=n; i++){
if(n%i==0){ V.push_back(i); if(i*i!=n) V.push_back(n/i); }
sort(V.begin(), V.end());
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
init();
D[0].push_back(0);
for(int i=1; i<(int)V.size(); i++){
vector<int> &W=D[i];
for(int j=0; j<i; j++)
if(V[i]%V[j]==0)
for(int x:D[j]) W.push_back(x+V[i]/V[j]-1);
sort(W.begin(), W.end());
W.resize(unique(W.begin(), W.end())-W.begin());
}
cout<<D[V.size()-1].size()<<'\n';
for(int x:D[V.size()-1]) cout<<x<<' ';
cout<<'\n';
return 0;
}
Compilation message
toy.cpp: In function 'void init()':
toy.cpp:18:11: error: a function-definition is not allowed here before '{' token
int main(){
^
toy.cpp:38:1: error: expected '}' at end of input
}
^