#include <iostream>
#include <cstdio>
using namespace std;
//int good[100005][305];
int chk[100005], cur[100005];
int p = 1;
int res[100005], rn;
// table[i][j] : 길이 j로 답이 i인 걸 만들 수 있는가?
void solve (int t) {
if(cur[t] < 0) {
solve(-cur[t]);
solve(t + cur[t]);
}else {
for(int i = 0; i < chk[t]; i++) {
res[++rn] = (i < cur[t]) ? p : 293-p;
}
p += 3;
}
}
int main() {
for(int i = 1; i <= 100000; i++) chk[i] = (int)1e9;
for(int a = 1; a <= 300; a++) {
for(int b = 1; b <= 300-a; b++) {
// good[a*b][a+b] = a;
if(chk[a*b] > a+b) {
cur[a*b] = a;
chk[a*b] = a+b;
}
}
}
for(int i = 1; i <= 10000; i++) if(chk[i] == (int)1e9) {
for(int j = 1; j < i; j++) {
if(chk[i] > chk[j] + chk[i-j]) {
cur[i] = -j;
(chk[i] = chk[j] + chk[i-j]);
}
}
}
int t; scanf("%d", &t);
solve(t);
printf("%d 293\n", rn);
for(int i = 1; i <= rn; i++) printf("%d ", res[i]);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
2848 KB |
Output is correct |
2 |
Correct |
24 ms |
2848 KB |
Output is correct |
3 |
Correct |
32 ms |
2848 KB |
Output is correct |
4 |
Correct |
32 ms |
2848 KB |
Output is correct |
5 |
Correct |
32 ms |
2848 KB |
Output is correct |
6 |
Correct |
36 ms |
2848 KB |
Output is correct |
7 |
Correct |
32 ms |
2848 KB |
Output is correct |
8 |
Correct |
36 ms |
2848 KB |
Output is correct |
9 |
Correct |
32 ms |
2848 KB |
Output is correct |
10 |
Correct |
28 ms |
2848 KB |
Output is correct |
11 |
Correct |
32 ms |
2848 KB |
Output is correct |
12 |
Correct |
32 ms |
2848 KB |
Output is correct |
13 |
Correct |
28 ms |
2848 KB |
Output is correct |
14 |
Correct |
36 ms |
2848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
2848 KB |
Output is correct |
2 |
Correct |
32 ms |
2848 KB |
Output is correct |
3 |
Correct |
32 ms |
2848 KB |
Output is correct |
4 |
Correct |
32 ms |
2848 KB |
Output is correct |
5 |
Correct |
32 ms |
2848 KB |
Output is correct |
6 |
Correct |
32 ms |
2848 KB |
Output is correct |
7 |
Correct |
32 ms |
2848 KB |
Output is correct |
8 |
Correct |
32 ms |
2848 KB |
Output is correct |
9 |
Correct |
32 ms |
2848 KB |
Output is correct |
10 |
Correct |
28 ms |
2848 KB |
Output is correct |
11 |
Correct |
32 ms |
2848 KB |
Output is correct |
12 |
Correct |
32 ms |
2848 KB |
Output is correct |
13 |
Correct |
32 ms |
2848 KB |
Output is correct |
14 |
Correct |
32 ms |
2848 KB |
Output is correct |
15 |
Correct |
28 ms |
2848 KB |
Output is correct |
16 |
Correct |
32 ms |
2848 KB |
Output is correct |
17 |
Correct |
32 ms |
2848 KB |
Output is correct |
18 |
Correct |
32 ms |
2848 KB |
Output is correct |
19 |
Correct |
32 ms |
2848 KB |
Output is correct |
20 |
Correct |
32 ms |
2848 KB |
Output is correct |
21 |
Correct |
36 ms |
2848 KB |
Output is correct |
22 |
Correct |
36 ms |
2848 KB |
Output is correct |
23 |
Correct |
32 ms |
2848 KB |
Output is correct |
24 |
Correct |
28 ms |
2848 KB |
Output is correct |
25 |
Correct |
32 ms |
2848 KB |
Output is correct |
26 |
Correct |
28 ms |
2848 KB |
Output is correct |
27 |
Correct |
28 ms |
2848 KB |
Output is correct |
28 |
Incorrect |
32 ms |
2848 KB |
Output isn't correct - the number of ways is not correct |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |