結果

問題 No.670 log は定数
ユーザー te-shte-sh
提出日時 2018-04-20 10:20:39
言語 D
(dmd 2.106.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,012 bytes
コンパイル時間 1,114 ms
コンパイル使用メモリ 89,276 KB
実行使用メモリ 26,312 KB
最終ジャッジ日時 2023-09-03 19:58:12
合計ジャッジ時間 52,930 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void pickV(R,T...)(ref R r,ref T t){foreach(ref v;t)pick(r,v);}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

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

const tb = 31, ub = 19, db = tb-ub;

void main()
{
  int n, q; readV(n, q, seed);

  foreach (i; 0..10000) next();

  auto a = new int[](n);
  foreach (i; 0..n) a[i] = next();

  auto b = new int[][](1<<ub), c = new int[](1<<ub);
  foreach (ai; a) {
    b[ai>>db] ~= ai;
    ++c[ai>>db];
  }
  auto cc = new int[](1<<ub+1);
  foreach (i; 0..1<<ub) cc[i+1] = cc[i]+c[i];

  auto ans = 0uL;
  foreach (ulong i; 0..q) {
    auto x = next(), xi = (x>>db);
    ans ^= i * (cc[xi] + b[xi].count!(bi => bi < x));
  }

  writeln(ans);
}
0