# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
161349 | luciocf | Toys (CEOI18_toy) | C++14 | 5037 ms | 1080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
int n;
scanf("%d", &n);
if (n == 1)
{
printf("1\n0\n");
return 0;
}
vector<int> p;
int aux = n;
for (int i = 2; i*i <= aux; i++)
{
while (aux%i == 0)
{
aux /= i;
p.push_back(i);
}
}
if (aux > 1) p.push_back(aux);
set<int> ans;
do
{
for (int mask = 0; mask < (1<<((int)p.size()-1)); mask++)
{
if (ans.size() >= 27000)
{
printf("%d\n", ans.size());
for (auto x: ans)
printf("%d ", x);
printf("\n");
return 0;
}
int soma = 0;
int prod = 1, prod2 = 1;
for (int i = 0; i < ((int)p.size()-1); i++)
{
prod *= p[i];
if (mask&(1<<i))
{
soma += (prod-1);
prod2 *= prod;
prod = 1;
}
}
prod *= p.back();
soma += (prod-1);
prod2 *= prod;
if (prod2 == n)
ans.insert(soma);
}
} while (next_permutation(p.begin(), p.end()));
printf("%d\n", ans.size());
for (auto x: ans)
printf("%d ", x);
printf("\n");
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |