結果
問題 | No.1880 Many Ways |
ユーザー |
|
提出日時 | 2022-03-17 17:06:18 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,037 bytes |
コンパイル時間 | 1,315 ms |
コンパイル使用メモリ | 119,824 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 13:52:46 |
合計ジャッジ時間 | 12,679 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 8 |
ソースコード
#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; }