結果

問題 No.670 log は定数
ユーザー uafr_csuafr_cs
提出日時 2018-03-23 23:32:18
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 1,333 bytes
コンパイル時間 4,810 ms
コンパイル使用メモリ 80,076 KB
実行使用メモリ 847,480 KB
最終ジャッジ日時 2023-09-07 04:22:22
合計ジャッジ時間 11,637 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	
	public static final long MOD = 1000000007;
	
	static long seed;
	static int next() {
		seed = seed ^ (seed << 13);
		seed = seed ^ (seed >>> 7);
		seed = seed ^ (seed << 17);
		return (int)(seed >>> 33);
	}
	
	public static class Pair implements Comparable<Pair> {
		int q;
		long value;
		
		public Pair(int q, long value){
			this.q = q;
			this.value = value;
		}

		@Override
		public int compareTo(Pair o) {
			return Long.compare(this.value, o.value);
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int Q = sc.nextInt();
		seed = sc.nextLong();
		
		for (int i = 0; i < 10000; i++){ next();}
		
		int[] array = new int[N];
		for(int i = 0; i < N; i++){ array[i] = next(); }
		Arrays.sort(array);
		
		Pair[] query = new Pair[Q];
		for(int q = 0; q < Q; q++){
			query[q] = new Pair(q, next());
		}
		Arrays.sort(query);
		
		long answer = 0;
		
		int count = 0;
		for(final Pair q : query){
			while(count < N && array[count] < q.value){ count++; }
			
			final long q_answer = count;
			answer ^= q_answer * q.q;
		}
		
		System.out.println(answer);
	}
}
0