結果
問題 | No.670 log は定数 |
ユーザー | yosupot |
提出日時 | 2017-09-10 16:37:55 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 2,931 ms / 4,000 ms |
コード長 | 868 bytes |
コンパイル時間 | 1,810 ms |
コンパイル使用メモリ | 142,736 KB |
実行使用メモリ | 6,568 KB |
最終ジャッジ日時 | 2023-09-03 16:14:12 |
合計ジャッジ時間 | 34,053 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,883 ms
5,992 KB |
testcase_01 | AC | 2,902 ms
6,328 KB |
testcase_02 | AC | 2,895 ms
5,048 KB |
testcase_03 | AC | 2,902 ms
6,012 KB |
testcase_04 | AC | 2,913 ms
6,268 KB |
testcase_05 | AC | 2,920 ms
5,536 KB |
testcase_06 | AC | 2,920 ms
5,728 KB |
testcase_07 | AC | 2,923 ms
6,328 KB |
testcase_08 | AC | 2,907 ms
6,568 KB |
testcase_09 | AC | 2,931 ms
5,160 KB |
ソースコード
import std.stdio, std.algorithm, std.range; ulong seed; int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return cast(int)(seed >> 33); } immutable B = 200000; immutable S = (1L<<32) / B + 1; void main() { int n; int q; readf("%d %d %d\n", &n, &q, &seed); foreach (i; 0..10000) next(); int[] a = new int[n]; foreach (i; 0..n) a[i] = next(); a.sort!"a<b"; int[] l = new int[B]; int[] r = new int[B]; int c = 0; foreach (i; 0..B) { l[i] = c; while (c < n && (a[c] / S) == i) c++; r[i] = c; } long query(int x) { int i = x / S; return a[l[i]..r[i]].assumeSorted.lowerBound(x).length + l[i]; } long sm = 0; foreach (i; 0..q) { int x = next(); sm ^= query(x) * i; } writeln(sm); }