結果
問題 | No.670 log は定数 |
ユーザー | yosupot |
提出日時 | 2017-09-10 03:36:06 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,759 ms / 4,000 ms |
コード長 | 1,446 bytes |
コンパイル時間 | 2,063 ms |
コンパイル使用メモリ | 77,428 KB |
実行使用メモリ | 47,656 KB |
最終ジャッジ日時 | 2024-04-25 03:03:42 |
合計ジャッジ時間 | 21,609 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,714 ms
47,632 KB |
testcase_01 | AC | 1,709 ms
47,268 KB |
testcase_02 | AC | 1,713 ms
47,464 KB |
testcase_03 | AC | 1,695 ms
47,648 KB |
testcase_04 | AC | 1,747 ms
47,656 KB |
testcase_05 | AC | 1,709 ms
47,032 KB |
testcase_06 | AC | 1,759 ms
47,656 KB |
testcase_07 | AC | 1,734 ms
47,512 KB |
testcase_08 | AC | 1,744 ms
47,524 KB |
testcase_09 | AC | 1,725 ms
47,216 KB |
ソースコード
import java.util.*; public class Main { static long seed; static int next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >>> 7); seed = seed ^ (seed << 17); return (int)(seed >>> 33); } static final long B = 300000; static final long S = (1L<<32) / B + 1; static int n; static int[] a, L, R; public static void first() { L = new int[(int)B]; R = new int[(int)B]; int c = 0; for (int i = 0; i < B; i++) { L[i] = c; while (c < n && (int)(a[c] / S) == i) c++; R[i] = c; } } public static int query(int x) { int i = (int)(x / S); int l = L[i]-1, r = R[i]; while (r-l > 1) { int md = (l+r)/2; if (a[md] < x) { l = md; } else { r = md; } } return r; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); int q = sc.nextInt(); seed = sc.nextLong(); for (int i = 0; i < 10000; i++) next(); a = new int[n]; for (int i = 0; i < n; i++) a[i] = next(); Arrays.sort(a); first(); long sm = 0; for (int i = 0; i < q; i++) { int x = next(); sm ^= (long)(query(x)) * i; } System.out.println(sm); } }