結果

問題 No.670 log は定数
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2018-03-23 23:33:54
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,198 ms / 4,000 ms
コード長 1,019 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 80,524 KB
実行使用メモリ 5,068 KB
最終ジャッジ日時 2023-09-07 04:23:22
合計ジャッジ時間 14,489 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,160 ms
4,824 KB
testcase_01 AC 1,198 ms
5,008 KB
testcase_02 AC 1,152 ms
5,068 KB
testcase_03 AC 1,156 ms
4,828 KB
testcase_04 AC 1,169 ms
4,820 KB
testcase_05 AC 1,155 ms
4,860 KB
testcase_06 AC 1,163 ms
4,948 KB
testcase_07 AC 1,152 ms
4,872 KB
testcase_08 AC 1,153 ms
4,812 KB
testcase_09 AC 1,157 ms
4,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

using ll = long long;
using ull = unsigned long long;

ull seed;
int next() {
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}

const int B = 1 << 18;
const int C = 1 << 13;
int help[B+1];


int main() {
  int n, q;
  cin >> n >> q >> seed;
  for (int i = 0; i < 10000; i++) next();
    
  vector<int> a(n);
  for (int i = 0; i < n; i++) a[i] = next();
  sort(a.begin(), a.end());

  // precomp
  rep(i,B) {
    int cnt=lower_bound(a.begin(),a.end(),i*C)-a.begin();
    help[i]=cnt;
  }
  help[B]=n;

  ll sm = 0;
  for (int i = 0; i < q; i++) {
    int x = next();
    int msk=x>>13;
    int lo=help[msk],hi=help[msk+1];
    int cnt = lower_bound(a.begin()+lo,a.begin()+hi,x)-a.begin();
    sm ^= ll(cnt) * i;
  }
  cout << sm << endl;
  return 0;
}
0