結果

問題 No.814 ジジ抜き
ユーザー aa
提出日時 2019-04-14 01:18:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 277 ms / 3,000 ms
コード長 541 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 164,520 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 14:43:43
合計ジャッジ時間 7,754 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 272 ms
4,352 KB
testcase_05 AC 273 ms
4,348 KB
testcase_06 AC 277 ms
4,352 KB
testcase_07 AC 140 ms
4,348 KB
testcase_08 AC 272 ms
4,348 KB
testcase_09 AC 201 ms
4,352 KB
testcase_10 AC 269 ms
4,348 KB
testcase_11 AC 272 ms
4,352 KB
testcase_12 AC 139 ms
4,352 KB
testcase_13 AC 140 ms
4,352 KB
testcase_14 AC 211 ms
4,348 KB
testcase_15 AC 108 ms
4,348 KB
testcase_16 AC 107 ms
4,352 KB
testcase_17 AC 221 ms
4,352 KB
testcase_18 AC 190 ms
4,352 KB
testcase_19 AC 266 ms
4,352 KB
testcase_20 AC 140 ms
4,352 KB
testcase_21 AC 158 ms
4,352 KB
testcase_22 AC 227 ms
4,348 KB
testcase_23 AC 115 ms
4,348 KB
testcase_24 AC 199 ms
4,348 KB
testcase_25 AC 162 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;

long f(long x)
{
	if (x % 4 == 0)
	{
		return x;
	}
	else if (x % 4 == 1)
	{
		return 1L;
	}
	else if (x % 4 == 2)
	{
		return x + 1;
	}
	else
	{
		return 0L;
	}
}

void solve()
{
	int n;
	cin >> n;
	long ans = 0;
	while(n--)
	{
		long k, l, d;
		cin >> k >> l >> d;
		long sl = l >> d, res = f(max(sl-1, 0L)) ^ f(sl + k - 1);
		ans ^= res << d;
		if (k & 1)
		{
			ans ^= l ^ (sl << d);
		}
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}
0