Submission #520275

#TimeUsernameProblemLanguageResultExecution timeMemory
520275KoDKonstrukcija (COCI20_konstrukcija)C++17
110 / 110
1 ms336 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...