#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::tuple;
using std::pair;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
long long K;
std::cin >> K;
const int D = 64;
const int V = 4 * D + 3;
vector<pair<int, int>> edge;
for (int i = 2; i <= 4; ++i) {
edge.emplace_back(i, V);
}
for (int d = 1; d < D; ++d) {
const int a = 3 * d;
const int b = 3 * d + 3;
for (int i = -1; i <= 1; ++i) {
for (int j = -1; j <= 1; ++j) {
edge.emplace_back(b + j, a + i);
}
}
}
for (int i = 3 * D - 1; i <= 3 * D + 1; ++i) {
edge.emplace_back(3 * D + 2, i);
}
edge.emplace_back(1, 3 * D + 2);
int coeff = -1;
for (int i = 1; i <= D; ++i) {
edge.emplace_back(3 * D + 2 + i, 3 * i - 1);
edge.emplace_back(3 * D + 2 + i, 3 * i + 1);
if (K % 2 != 0) {
K -= coeff;
edge.emplace_back(1, 3 * D + 2 + i);
}
K /= 2;
coeff *= -1;
}
std::cout << V << ' ' << edge.size() << '\n';
for (const auto& [a, b] : edge) {
std::cout << a << ' ' << b << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Correct. |
2 |
Correct |
1 ms |
316 KB |
Correct. |
3 |
Correct |
1 ms |
336 KB |
Correct. |
4 |
Correct |
1 ms |
336 KB |
Correct. |
5 |
Correct |
1 ms |
336 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Correct. |
2 |
Correct |
0 ms |
320 KB |
Correct. |
3 |
Correct |
1 ms |
316 KB |
Correct. |
4 |
Correct |
0 ms |
336 KB |
Correct. |
5 |
Correct |
1 ms |
336 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Correct. |
2 |
Correct |
1 ms |
316 KB |
Correct. |
3 |
Correct |
1 ms |
336 KB |
Correct. |
4 |
Correct |
1 ms |
336 KB |
Correct. |
5 |
Correct |
1 ms |
336 KB |
Correct. |
6 |
Correct |
1 ms |
332 KB |
Correct. |
7 |
Correct |
0 ms |
320 KB |
Correct. |
8 |
Correct |
1 ms |
316 KB |
Correct. |
9 |
Correct |
0 ms |
336 KB |
Correct. |
10 |
Correct |
1 ms |
336 KB |
Correct. |
11 |
Correct |
1 ms |
336 KB |
Correct. |
12 |
Correct |
1 ms |
336 KB |
Correct. |
13 |
Correct |
1 ms |
336 KB |
Correct. |
14 |
Correct |
1 ms |
336 KB |
Correct. |
15 |
Correct |
1 ms |
316 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Correct. |
2 |
Correct |
1 ms |
316 KB |
Correct. |
3 |
Correct |
1 ms |
336 KB |
Correct. |
4 |
Correct |
1 ms |
336 KB |
Correct. |
5 |
Correct |
1 ms |
336 KB |
Correct. |
6 |
Correct |
1 ms |
332 KB |
Correct. |
7 |
Correct |
0 ms |
320 KB |
Correct. |
8 |
Correct |
1 ms |
316 KB |
Correct. |
9 |
Correct |
0 ms |
336 KB |
Correct. |
10 |
Correct |
1 ms |
336 KB |
Correct. |
11 |
Correct |
1 ms |
336 KB |
Correct. |
12 |
Correct |
1 ms |
336 KB |
Correct. |
13 |
Correct |
1 ms |
336 KB |
Correct. |
14 |
Correct |
1 ms |
336 KB |
Correct. |
15 |
Correct |
1 ms |
316 KB |
Correct. |
16 |
Correct |
1 ms |
312 KB |
Correct. |
17 |
Correct |
1 ms |
336 KB |
Correct. |
18 |
Correct |
1 ms |
320 KB |
Correct. |
19 |
Correct |
1 ms |
312 KB |
Correct. |
20 |
Correct |
1 ms |
336 KB |
Correct. |
21 |
Correct |
1 ms |
336 KB |
Correct. |
22 |
Correct |
1 ms |
336 KB |
Correct. |
23 |
Correct |
1 ms |
336 KB |
Correct. |
24 |
Correct |
1 ms |
336 KB |
Correct. |
25 |
Correct |
1 ms |
316 KB |
Correct. |
26 |
Correct |
1 ms |
316 KB |
Correct. |
27 |
Correct |
1 ms |
336 KB |
Correct. |