# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424666 | 2021-06-12T08:55:18 Z | Hazem | Toys (CEOI18_toy) | C++14 | 149 ms | 262148 KB |
#include <bits/stdc++.h> using namespace std; #define LL long long #define F first #define S second #define pii pair<int,int> #define piii pair<pair<int,int>,int> const int N = 2e5+10; const int M = 1e3+10; const LL INF = 1e12; const LL LINF = 2e18; const LL MOD = 1e9+7; const double PI = 3.141592653589793; vector<LL>vec; set<LL>st; LL n; void bt(int pos,int sum,LL p){ if(pos==vec.size()){ if(p==n)st.insert(sum); return ; } if(n%(p*vec[pos])==0) bt(pos,sum+vec[pos]-1,p*vec[pos]); bt(pos+1,sum,p); } int main(){ //freopen("out.txt","w",stdout); scanf("%lld",&n); for(LL i=2;i*i<=n;i++){ if(n%i==0)vec.push_back(i); if((n%i==0)&&(n/i!=i))vec.push_back(n/i); } vec.push_back(n); bt(0,0,1); printf("%d\n",st.size()); for(auto x:st) printf("%lld ",x); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 149 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 149 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 149 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 149 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 149 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |