結果
問題 |
No.2881 Mod 2^N
|
ユーザー |
![]() |
提出日時 | 2024-09-08 13:30:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,007 bytes |
コンパイル時間 | 5,298 ms |
コンパイル使用メモリ | 308,408 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-08 13:30:14 |
合計ジャッジ時間 | 9,349 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 11 WA * 19 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; int n; ll f(ll x, int i) { return (x * (1LL << i) + 1) % (1LL << n); } void out(vector<int> a) { cout << a.size() << endl; for (auto x : a) { cout << x << ' '; } cout << endl; } int main() { ll x, y; cin >> n >> x >> y; vector<int> ans; if (x == y) { out(ans); return 0; } if (y == 0) { cout << -1 << endl; return 0; } if (y % 2) { cout << -1 << endl; return 0; } vector<int> bits; rep(i, 0, 61) { if (y & (1LL << i)) { bits.push_back(i); } } x = 1; ans.push_back(n); reverse(bits.begin(), bits.end()); rep(i, 0, bits.size() - 1) { ans.push_back(bits[i] - bits[i + 1]); } out(ans); // rep(i, 0, ans.size()) { x = f(x, ans[i]); } // assert(x == y); }