結果
問題 |
No.814 ジジ抜き
|
ユーザー |
![]() |
提出日時 | 2018-01-23 17:19:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 96 ms / 3,000 ms |
コード長 | 727 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 66,320 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 00:09:36 |
合計ジャッジ時間 | 5,806 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
// 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; }