結果
| 問題 | No.3547 Rurumaru Function Problem |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2026-05-25 20:36:37 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 400 bytes |
| 記録 | |
| コンパイル時間 | 944 ms |
| コンパイル使用メモリ | 179,388 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-05-25 20:36:39 |
| 合計ジャッジ時間 | 2,003 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
using ll = long long;
int main(){
int n, m;
cin >> n >> m;
int ans = 0;
rep(i, 0, 30) {
int b = 1 << i;
if(m & b) {
if(i % 2) {
if((n & b) == 0) ans |= b;
}
else {
if((n & b) == 0) {
cout << -1 << endl;
return 0;
}
ans |= b;
}
}
}
cout << ans << endl;
}
forest3