結果
問題 |
No.2881 Mod 2^N
|
ユーザー |
|
提出日時 | 2024-09-08 13:19:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 2,292 ms |
コンパイル使用メモリ | 195,300 KB |
最終ジャッジ日時 | 2025-02-24 05:30:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, x, y; cin >> n >> x >> y; if(x == y){ cout << 0 << '\n'; return 0; } if(y % 2 == 0){ cout << -1 << '\n'; return 0; } vector<int> ans; while(y > 1){ y--; int lg = __lg(y & -y); ans.emplace_back(lg); y >>= lg; } ans.emplace_back(n); reverse(ans.begin(), ans.end()); cout << ans.size() << '\n'; for(int i = 0; i < ans.size(); i++){ cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' '); } }