# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917913 | 2024-01-29T05:11:43 Z | PM1 | Toys (CEOI18_toy) | C++17 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long int n; ll sum=1,res=0; vector<int>v,ans; void solve(int p=0){ if(sum==n){ ans.push_back(res); return ; } for(;p<v.size();p++){ if(sum*v[p]>n)return; sum*=v[p]; res+=v[p]-1; solve(p); sum/=v[p]; res-=v[p]-1; } } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; int num=n; for(int i=2;i*i<=n;i++){ if(num%i)continue; v.push_back(i); if(i*i<n) v.push_back(n/i); } v.push_back(n); sort(v.begin(),v.end()); solve(); sort(ans.begin(),ans.end()); ans.resize(unique(v.begin(),v.end())-v.begin()); cout<<ans.size()<<'\n'; for(auto i:ans) cout<<i<<" "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |