提出 #4517026
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>; using LL = long long;
using VI = vector<int>; using VVI = vector<VI>;
using PII = pair<int, int>; using PLL = pair<LL, LL>;
using VL = vector<LL>; using VVL = vector<VL>;
#define ALL(a) begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3")
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x)
#endif
const int INF = 1e9; const LL LINF = 1e16;
const LL MOD = 1000000007; const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 }; int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
/* ----- 2019/03/09 Problem: ABC 121 D / Link: http://abc121.contest.atcoder.jp/tasks/abc121_d ----- */
long long xorxor(long long val) {
long long ret = ((val + 1) / 2) % 2;
for (int i = 0; i <= 59; i++) if ((val >> i) % 2) ret |= (1 ^ (val % 2)) << i;
return ret;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
LL A, B; cin >> A >> B;
LL ans = xorxor(B);
if (A) {
ans ^= xorxor(A - 1);
}
cout << (ans) << "\n";
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
D - XOR World |
| ユーザ |
Yang33 |
| 言語 |
C++14 (GCC 5.4.1) |
| 得点 |
400 |
| コード長 |
1452 Byte |
| 結果 |
AC |
| 実行時間 |
1 ms |
| メモリ |
256 KiB |
ジャッジ結果
| セット名 |
All |
Sample |
| 得点 / 配点 |
400 / 400 |
0 / 0 |
| 結果 |
|
|
| セット名 |
テストケース |
| All |
sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_20, testcase_21, testcase_22, testcase_23 |
| Sample |
sample_01, sample_02, sample_03 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| sample_01 |
AC |
1 ms |
256 KiB |
| sample_02 |
AC |
1 ms |
256 KiB |
| sample_03 |
AC |
1 ms |
256 KiB |
| testcase_01 |
AC |
1 ms |
256 KiB |
| testcase_02 |
AC |
1 ms |
256 KiB |
| testcase_03 |
AC |
1 ms |
256 KiB |
| testcase_04 |
AC |
1 ms |
256 KiB |
| testcase_05 |
AC |
1 ms |
256 KiB |
| testcase_06 |
AC |
1 ms |
256 KiB |
| testcase_07 |
AC |
1 ms |
256 KiB |
| testcase_08 |
AC |
1 ms |
256 KiB |
| testcase_09 |
AC |
1 ms |
256 KiB |
| testcase_10 |
AC |
1 ms |
256 KiB |
| testcase_11 |
AC |
1 ms |
256 KiB |
| testcase_12 |
AC |
1 ms |
256 KiB |
| testcase_13 |
AC |
1 ms |
256 KiB |
| testcase_14 |
AC |
1 ms |
256 KiB |
| testcase_15 |
AC |
1 ms |
256 KiB |
| testcase_16 |
AC |
1 ms |
256 KiB |
| testcase_17 |
AC |
1 ms |
256 KiB |
| testcase_18 |
AC |
1 ms |
256 KiB |
| testcase_19 |
AC |
1 ms |
256 KiB |
| testcase_20 |
AC |
1 ms |
256 KiB |
| testcase_21 |
AC |
1 ms |
256 KiB |
| testcase_22 |
AC |
1 ms |
256 KiB |
| testcase_23 |
AC |
1 ms |
256 KiB |