# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70610 | 2018-08-23T07:29:11 Z | cs(#2192) | Toys (CEOI18_toy) | C++11 | 5 ms | 3372 KB |
#include<stdio.h> #include<vector> #include<map> #include<algorithm> using namespace std; int mn; map<int, int>M; vector<int>L[121212]; void get_ans(int n) { if (M.find(n) != M.end())return; int now = M[n] = ++mn; L[mn].push_back(n - 1); int i, j, w; for (i = 2; i*i <= n; i++) { if (n%i == 0) { get_ans(i), get_ans(n / i); w = M[i]; for (j = 0; j < L[w].size(); j++) L[now].push_back(L[w][j] + (i - 1)); w = M[n/i]; for (j = 0; j < L[w].size(); j++) L[now].push_back(L[w][j] + (i - 1)); } } sort(L[now].begin(),L[now].end()); L[now].erase(unique(L[now].begin(), L[now].end()), L[now].end()); } int main() { long long n, i, j; scanf("%d", &n); get_ans(n); int w = M[n]; printf("%d\n", L[w].size()); for (i = 0; i < L[w].size(); i++) { printf("%d ", L[w][i]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3068 KB | Output is correct |
2 | Correct | 5 ms | 3176 KB | Output is correct |
3 | Correct | 4 ms | 3248 KB | Output is correct |
4 | Correct | 5 ms | 3372 KB | Output is correct |
5 | Correct | 5 ms | 3372 KB | Output is correct |
6 | Incorrect | 5 ms | 3372 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3068 KB | Output is correct |
2 | Correct | 5 ms | 3176 KB | Output is correct |
3 | Correct | 4 ms | 3248 KB | Output is correct |
4 | Correct | 5 ms | 3372 KB | Output is correct |
5 | Correct | 5 ms | 3372 KB | Output is correct |
6 | Incorrect | 5 ms | 3372 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3068 KB | Output is correct |
2 | Correct | 5 ms | 3176 KB | Output is correct |
3 | Correct | 4 ms | 3248 KB | Output is correct |
4 | Correct | 5 ms | 3372 KB | Output is correct |
5 | Correct | 5 ms | 3372 KB | Output is correct |
6 | Incorrect | 5 ms | 3372 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3068 KB | Output is correct |
2 | Correct | 5 ms | 3176 KB | Output is correct |
3 | Correct | 4 ms | 3248 KB | Output is correct |
4 | Correct | 5 ms | 3372 KB | Output is correct |
5 | Correct | 5 ms | 3372 KB | Output is correct |
6 | Incorrect | 5 ms | 3372 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 3068 KB | Output is correct |
2 | Correct | 5 ms | 3176 KB | Output is correct |
3 | Correct | 4 ms | 3248 KB | Output is correct |
4 | Correct | 5 ms | 3372 KB | Output is correct |
5 | Correct | 5 ms | 3372 KB | Output is correct |
6 | Incorrect | 5 ms | 3372 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |