結果
問題 | No.670 log は定数 |
ユーザー | te-sh |
提出日時 | 2018-04-20 10:21:46 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 2,450 ms / 4,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 553 ms |
コンパイル使用メモリ | 89,184 KB |
実行使用メモリ | 16,556 KB |
最終ジャッジ日時 | 2023-09-03 19:59:10 |
合計ジャッジ時間 | 27,695 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,398 ms
13,428 KB |
testcase_01 | AC | 2,382 ms
13,444 KB |
testcase_02 | AC | 2,389 ms
15,008 KB |
testcase_03 | AC | 2,447 ms
14,300 KB |
testcase_04 | AC | 2,384 ms
13,480 KB |
testcase_05 | AC | 2,357 ms
16,556 KB |
testcase_06 | AC | 2,356 ms
14,040 KB |
testcase_07 | AC | 2,447 ms
13,488 KB |
testcase_08 | AC | 2,450 ms
13,720 KB |
testcase_09 | AC | 2,404 ms
13,972 KB |
ソースコード
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 = 18, 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); }