結果

問題 No.814 ジジ抜き
ユーザー pekempey
提出日時 2019-04-14 17:30:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 282 ms / 3,000 ms
コード長 552 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 75,180 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-19 05:58:12
合計ジャッジ時間 7,324 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cstring>

using namespace std;

long long f(long long n) {
  n++;
  long long res = 0;
  for (long long k = n / 4 * 4; k < n; k++) {
    res ^= k;
  }
  return res;
}

int main() {
  int N;
  cin >> N;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    long long K, L, D;
    cin >> K >> L >> D;
    if (K % 2 == 1) {
      ans ^= L & (1LL << D) - 1;
    }
    L >>= D;
    ans ^= (f(L + (K - 1)) ^ f(L - 1)) << D;
  }
  cout << ans << endl;
}
0