結果

問題 No.670 log は定数
ユーザー yosupotyosupot
提出日時 2017-09-12 14:37:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,309 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 77,188 KB
実行使用メモリ 45,492 KB
最終ジャッジ日時 2024-04-25 07:03:39
合計ジャッジ時間 14,609 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        seed = sc.nextLong();
        for (int i = 0; i < 10000; i++) next();

        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = next();
        Arrays.sort(a);

        int[] idx = new int[(int)(B+1)];
        int c = 0;
        for (int i = 0; i <= B; i++) {
            idx[i] = c;
            while (c < n && (int)(a[c] / S) == i) c++;
        }
        
        long sm = 0;
        for (int qc = 0; qc < q; qc++) {
            int x = next();

            int i = (int)(x / S);
            int l = idx[i], r = idx[i+1];
            while (r-l > 1) {
                int md = (l+r)/2;
                if (a[md] < x) {
                    l = md;
                } else {
                    r = md;
                }
            }

            sm ^= (long)(r) * qc;
        }
        System.out.println(sm);
    }
}
0