結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー 小野寺健小野寺健
提出日時 2021-05-26 21:23:10
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,209 bytes
コンパイル時間 6,541 ms
コンパイル使用メモリ 77,736 KB
実行使用メモリ 65,232 KB
最終ジャッジ日時 2024-05-09 14:34:02
合計ジャッジ時間 51,673 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
46,700 KB
testcase_01 AC 146 ms
41,340 KB
testcase_02 AC 149 ms
41,380 KB
testcase_03 AC 1,621 ms
59,372 KB
testcase_04 AC 1,668 ms
59,260 KB
testcase_05 AC 1,556 ms
59,540 KB
testcase_06 AC 1,660 ms
59,352 KB
testcase_07 AC 1,781 ms
60,804 KB
testcase_08 AC 1,744 ms
60,768 KB
testcase_09 AC 1,027 ms
52,448 KB
testcase_10 AC 1,010 ms
52,640 KB
testcase_11 AC 1,985 ms
61,016 KB
testcase_12 AC 1,962 ms
61,272 KB
testcase_13 AC 1,770 ms
58,480 KB
testcase_14 AC 1,708 ms
58,784 KB
testcase_15 AC 1,593 ms
59,412 KB
testcase_16 AC 1,557 ms
59,356 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 AC 1,968 ms
60,868 KB
testcase_20 AC 1,881 ms
60,928 KB
testcase_21 AC 1,986 ms
60,228 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;

public class No1359 {
	
	private static long modpow(long x, long n, long m) {
		long ret = 1;
		while (n > 0) {
			if ((n & 1) != 0) {
				ret = ret * x % m;
			}
			x = x * x % m;
			n >>= 1;
		}
		return ret;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		int M = scan.nextInt();
		int[] P = new int[N];
		for (int i=0; i < N; i++) {
			P[i] = scan.nextInt();
		}
		Arrays.sort(P);
		int[] E = new int[N];
		for (int i=0; i < N; i++) {
			E[i] = scan.nextInt();
		}
		Arrays.sort(E);
		int[] A = new int[N];
		for (int i=0; i < N; i++) {
			A[i] = scan.nextInt();
		}
		Arrays.sort(A);
		int[] H = new int[N];
		for (int i=0; i < N; i++) {
			H[i] = scan.nextInt();
		}
		Arrays.sort(H);
		scan.close();
		long D = 0;
		long min = 0, max = 1;
		for (int i=0; i < N; i++) {	
			int p = P[i];
			int e = E[i];
			min = Math.min(p, e);
			max = Math.max(p, e);
			int a = A[i];
			int h = H[i];
			min = Math.min(min, Math.min(a, h));
			max = Math.max(max, Math.max(a, h)); 
			D = (D + modpow(max - min, (long)K, (long)M)) % M;
		}
		System.out.println(D);
	}
}
0