# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
536896 |
2022-03-14T06:59:10 Z |
zaneyu |
Toys (CEOI18_toy) |
C++14 |
|
0 ms |
212 KB |
/*input
36
*/
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define ll long long
#define ld long double
#define sz(x) (int)x.size()
#define pb push_back
#define unq(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn=2e4+5;
map<int,vector<int>> dp;
vector<int> rec(int n){
if(n==1){
vector<int> vv;
return vv;
}
if(dp.count(n)) return dp[n];
vector<int> vv={n-1};
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
auto z=rec(n/i);
for(int a:z) vv.pb(a+(i-1));
}
}
unq(vv);
return dp[n]=vv;
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
int n;
cin>>n;
auto z=rec(n);
unq(z);
cout<<sz(z)<<'\n';
for(int x:z) cout<<x<<' ';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |