# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
927864 |
2024-02-15T12:25:13 Z |
Regulus |
Toys (CEOI18_toy) |
C++17 |
|
1 ms |
604 KB |
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define bug(x) cerr << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const int Mxm = 10000;
int prime[Mxm+5];
vector<int> p, v, ans;
inline void sieve()
{
for (int i=2; i <= Mxm; ++i) prime[i] = i;
for (int i=2; i <= Mxm; ++i)
{
if (prime[i] == i) p.pb(i);
for (ll j : p)
{
if (i*j > Mxm) break;
prime[i * j] = j;
if (!(i % j)) break;
}
}
}
int main(void)
{ IO
int n, i;
cin >> n;
if (n == 1) assert(0);
sieve();
int cur = n, m = sqrt(n);
for (i=2; i <= m; ++i)
{
while (!(cur % i))
{
v.pb(i);
cur /= i;
}
}
if (cur > 1) v.pb(cur);
for (int s=0; s < (1 << (SZ(v)-1)); ++s)
{
cur = v[0];
int sum = 0;
for (int i=0; i < SZ(v)-1; ++i)
{
if ((s >> i) & 1)
{
sum += cur - 1;
cur = 1;
}
cur *= v[i+1];
}
sum += cur - 1;
ans.pb(sum);
}
sort(all(ans));
ans.resize(unique(all(ans))-ans.begin());
cout << SZ(ans) << '\n';
for (int x : ans) cout << x << ' ';
cout << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |