#include <stdio.h>
#define N 1000
#define M 1000
#define L 60
int main() {
static int ii[M], jj[M];
int m, i, l, a, b;
long long k;
scanf("%lld", &k);
m = 0;
for (a = 1; a <= 3; a++)
ii[m] = a, jj[m] = N - 1, m++;
for (l = 1; l < L; l++)
for (a = 1; a <= 3; a++)
for (b = 1; b <= 3; b++)
ii[m] = l * 3 + a, jj[m] = (l - 1) * 3 + b, m++;
for (b = 1; b <= 3; b++)
ii[m] = 0, jj[m] = (L - 1) * 3 + b, m++;
k += 1LL << L;
i = N - 2;
for (l = L; l >= 0; l -= 2)
while (k >= 1LL << l) {
ii[m] = 0, jj[m] = i, m++;
if (l > 0)
for (b = 1; b <= 3; b++)
ii[m] = i, jj[m] = (l - 1) * 3 + b, m++;
else
ii[m] = i, jj[m] = N - 1, m++;
i--, k -= 1LL << l;
}
printf("1000 %d\n", m);
while (m--)
printf("%d %d\n", ii[m] + 1, jj[m] + 1);
return 0;
}
Compilation message
konstrukcija.c: In function 'main':
konstrukcija.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%lld", &k);
| ^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct. |
2 |
Correct |
0 ms |
204 KB |
Correct. |
3 |
Correct |
0 ms |
204 KB |
Correct. |
4 |
Correct |
0 ms |
204 KB |
Correct. |
5 |
Correct |
0 ms |
204 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Correct. |
2 |
Correct |
1 ms |
204 KB |
Correct. |
3 |
Correct |
0 ms |
204 KB |
Correct. |
4 |
Correct |
0 ms |
204 KB |
Correct. |
5 |
Correct |
1 ms |
204 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct. |
2 |
Correct |
0 ms |
204 KB |
Correct. |
3 |
Correct |
0 ms |
204 KB |
Correct. |
4 |
Correct |
0 ms |
204 KB |
Correct. |
5 |
Correct |
0 ms |
204 KB |
Correct. |
6 |
Correct |
0 ms |
204 KB |
Correct. |
7 |
Correct |
1 ms |
204 KB |
Correct. |
8 |
Correct |
0 ms |
204 KB |
Correct. |
9 |
Correct |
0 ms |
204 KB |
Correct. |
10 |
Correct |
1 ms |
204 KB |
Correct. |
11 |
Correct |
1 ms |
204 KB |
Correct. |
12 |
Correct |
0 ms |
204 KB |
Correct. |
13 |
Correct |
0 ms |
204 KB |
Correct. |
14 |
Correct |
1 ms |
204 KB |
Correct. |
15 |
Correct |
1 ms |
204 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct. |
2 |
Correct |
0 ms |
204 KB |
Correct. |
3 |
Correct |
0 ms |
204 KB |
Correct. |
4 |
Correct |
0 ms |
204 KB |
Correct. |
5 |
Correct |
0 ms |
204 KB |
Correct. |
6 |
Correct |
0 ms |
204 KB |
Correct. |
7 |
Correct |
1 ms |
204 KB |
Correct. |
8 |
Correct |
0 ms |
204 KB |
Correct. |
9 |
Correct |
0 ms |
204 KB |
Correct. |
10 |
Correct |
1 ms |
204 KB |
Correct. |
11 |
Correct |
1 ms |
204 KB |
Correct. |
12 |
Correct |
0 ms |
204 KB |
Correct. |
13 |
Correct |
0 ms |
204 KB |
Correct. |
14 |
Correct |
1 ms |
204 KB |
Correct. |
15 |
Correct |
1 ms |
204 KB |
Correct. |
16 |
Correct |
1 ms |
204 KB |
Correct. |
17 |
Correct |
1 ms |
204 KB |
Correct. |
18 |
Correct |
1 ms |
204 KB |
Correct. |
19 |
Correct |
0 ms |
204 KB |
Correct. |
20 |
Correct |
1 ms |
204 KB |
Correct. |
21 |
Correct |
1 ms |
204 KB |
Correct. |
22 |
Correct |
0 ms |
204 KB |
Correct. |
23 |
Correct |
1 ms |
204 KB |
Correct. |
24 |
Correct |
1 ms |
332 KB |
Correct. |
25 |
Correct |
0 ms |
204 KB |
Correct. |
26 |
Correct |
1 ms |
280 KB |
Correct. |
27 |
Correct |
0 ms |
204 KB |
Correct. |