結果

問題 No.814 ジジ抜き
ユーザー a
提出日時 2019-04-14 01:18:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 305 ms / 3,000 ms
コード長 541 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 167,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 11:29:01
合計ジャッジ時間 8,359 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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