結果

問題 No.814 ジジ抜き
ユーザー Lepton_sLepton_s
提出日時 2018-01-23 17:19:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 3,000 ms
コード長 727 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 65,524 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 21:55:46
合計ジャッジ時間 6,019 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 86 ms
4,376 KB
testcase_05 AC 87 ms
4,376 KB
testcase_06 AC 93 ms
4,376 KB
testcase_07 AC 48 ms
4,380 KB
testcase_08 AC 90 ms
4,380 KB
testcase_09 AC 67 ms
4,380 KB
testcase_10 AC 90 ms
4,376 KB
testcase_11 AC 91 ms
4,380 KB
testcase_12 AC 46 ms
4,376 KB
testcase_13 AC 47 ms
4,376 KB
testcase_14 AC 70 ms
4,376 KB
testcase_15 AC 37 ms
4,376 KB
testcase_16 AC 37 ms
4,376 KB
testcase_17 AC 74 ms
4,380 KB
testcase_18 AC 64 ms
4,376 KB
testcase_19 AC 92 ms
4,376 KB
testcase_20 AC 48 ms
4,380 KB
testcase_21 AC 52 ms
4,380 KB
testcase_22 AC 77 ms
4,376 KB
testcase_23 AC 40 ms
4,380 KB
testcase_24 AC 68 ms
4,376 KB
testcase_25 AC 54 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// validator
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)

int main(){
	ll N;
	scanf("%lld", &N);
	if(N<0 || N>1e6){
		cerr<<"invalid N: "<<N<<endl;
		return -1;
	}
	ll x = 0;
	rep(i, N){
		ll K, L, D;
		scanf("%lld%lld%lld", &K, &L, &D);
		if(K<1||L<0||L>1e18||K>(ll)1e18+1||(L+((K-1)<<D))>(ll)1e18||K-1>(((ll)((ll)1e18-L)>>D)+10)){
			cerr<<"invalide K L D: "<<K<<" "<<L<<" "<<D<<endl;
			cerr<<L+((K-1)<<D)<<endl;
			return -1;
		}
		ll L2 = L>>D;
		while(K>0 && L2%4!=0){
			x ^= L;
			L += 1LL<<D;
			L2++;
			K--;
		}
		while(K%4!=0){
			x ^= L+((K-1)<<D);
			K--;
		}
	}
	printf("%lld\n", x);
	return 0;
}
0