結果
| 問題 | No.3547 Rurumaru Function Problem |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-05-23 15:42:21 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 684 bytes |
| 記録 | |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 52,692 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-23 15:42:25 |
| 合計ジャッジ時間 | 1,668 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3547.cc: No.3547 Rurumaru Function Problem - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int BN = 30;
/* typedef */
/* global variables */
/* subroutines */
/* main */
int main() {
int n, m;
scanf("%d%d", &n, &m);
int x = 0;
for (int i = 0; i < 30 && (n > 0 || m > 0); i++, n >>= 1, m >>= 1) {
int bn = (n & 1), bm = (m & 1);
if (! (i & 1)) {
if (bn == 0 && bm == 1) { puts("-1"); return 0; }
x |= (bm << i);
}
else {
if (bn == 1 && bm == 0) { puts("-1"); return 0; }
if (bn == 0) x |= (bm << i);
}
}
printf("%d\n", x);
return 0;
}
tnakao0123