結果
問題 | No.1880 Many Ways |
ユーザー | 👑 cologne |
提出日時 | 2022-03-17 17:06:18 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,037 bytes |
コンパイル時間 | 2,784 ms |
コンパイル使用メモリ | 118,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-08 23:47:33 |
合計ジャッジ時間 | 15,162 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,948 KB |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
6,948 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
#include <functional> #include <iostream> #include <optional> #include <vector> #include <atcoder/modint> using namespace std; int main() { long long A; cin >> A; assert(0 <= A && A < (1LL << 40)); long long br = 0; vector<int> ab; bool fd = 0; for (int i = 40; i >= 0; --i) { if (A & (1LL << i)) { if (!fd) fd = 1; else ab.push_back(1); } else if (fd) ab.push_back(0); } reverse(ab.begin(), ab.end()); if (A == 0) { cout << 2 << " " << 0 << endl; return 0; } else if (A == 1) { cout << 1 << " " << 0 << endl; return 0; } int d = 2, u1 = 3, u2 = 4; vector<pair<int, int>> V = {{1, d}, {1, u1}, {1, u2}}; for (int a : ab) { V.emplace_back(d, d + 3); V.emplace_back(u1, u1 + 3); V.emplace_back(u1, u2 + 3); V.emplace_back(u2, u1 + 3); V.emplace_back(u2, u2 + 3); if (a) V.emplace_back(d, u1 + 3), V.emplace_back(d, u2 + 3); A >>= 1; d += 3; u1 += 3; u2 += 3; } cout << u2 << " " << V.size() << endl; for (auto [a, b] : V) cout << a << " " << b << endl; }