結果

問題 No.670 log は定数
ユーザー yosupotyosupot
提出日時 2018-03-23 23:04:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,631 ms / 4,000 ms
コード長 1,308 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 74,024 KB
実行使用メモリ 62,548 KB
最終ジャッジ日時 2023-09-07 04:08:07
合計ジャッジ時間 20,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,565 ms
61,520 KB
testcase_01 AC 1,525 ms
60,580 KB
testcase_02 AC 1,631 ms
62,548 KB
testcase_03 AC 1,598 ms
60,368 KB
testcase_04 AC 1,529 ms
61,476 KB
testcase_05 AC 1,531 ms
60,680 KB
testcase_06 AC 1,611 ms
60,580 KB
testcase_07 AC 1,565 ms
60,912 KB
testcase_08 AC 1,563 ms
61,244 KB
testcase_09 AC 1,597 ms
61,252 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 1<<18;
    static final long S = 1L<<14;

    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] >>> 14) == i) c++;
        }
        
        long sm = 0;
        for (int qc = 0; qc < q; qc++) {
            int x = next();

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

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