結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー 小野寺健小野寺健
提出日時 2021-05-26 21:14:23
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,437 bytes
コンパイル時間 4,779 ms
コンパイル使用メモリ 86,124 KB
実行使用メモリ 87,280 KB
最終ジャッジ日時 2024-04-28 05:04:05
合計ジャッジ時間 137,575 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
39,956 KB
testcase_01 AC 139 ms
41,256 KB
testcase_02 AC 142 ms
41,588 KB
testcase_03 AC 1,816 ms
69,988 KB
testcase_04 AC 1,787 ms
71,032 KB
testcase_05 AC 1,825 ms
69,096 KB
testcase_06 AC 1,767 ms
69,376 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 1,041 ms
55,528 KB
testcase_10 AC 1,034 ms
55,576 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,878 ms
71,984 KB
testcase_14 AC 1,928 ms
73,016 KB
testcase_15 AC 1,850 ms
69,588 KB
testcase_16 AC 1,770 ms
69,500 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,967 ms
72,624 KB
testcase_24 AC 1,958 ms
72,992 KB
testcase_25 AC 725 ms
50,212 KB
testcase_26 AC 757 ms
49,892 KB
testcase_27 AC 1,404 ms
63,236 KB
testcase_28 AC 1,376 ms
63,880 KB
testcase_29 AC 1,547 ms
67,300 KB
testcase_30 AC 1,574 ms
67,468 KB
testcase_31 AC 1,863 ms
69,348 KB
testcase_32 AC 1,780 ms
70,316 KB
testcase_33 AC 1,629 ms
67,000 KB
testcase_34 AC 1,629 ms
67,228 KB
testcase_35 AC 1,853 ms
69,744 KB
testcase_36 AC 1,775 ms
69,456 KB
testcase_37 AC 792 ms
50,284 KB
testcase_38 AC 783 ms
50,048 KB
testcase_39 AC 723 ms
49,760 KB
testcase_40 AC 683 ms
49,680 KB
testcase_41 AC 1,031 ms
55,028 KB
testcase_42 AC 973 ms
53,544 KB
testcase_43 AC 925 ms
51,192 KB
testcase_44 TLE -
testcase_45 AC 1,618 ms
67,456 KB
testcase_46 AC 865 ms
50,808 KB
testcase_47 AC 1,979 ms
73,272 KB
testcase_48 AC 1,923 ms
72,996 KB
testcase_49 AC 1,965 ms
73,592 KB
testcase_50 AC 1,731 ms
69,344 KB
testcase_51 AC 414 ms
48,312 KB
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
testcase_60 TLE -
testcase_61 TLE -
testcase_62 TLE -
testcase_63 TLE -
testcase_64 TLE -
testcase_65 TLE -
testcase_66 TLE -
testcase_67 TLE -
testcase_68 TLE -
testcase_69 TLE -
testcase_70 TLE -
testcase_71 TLE -
testcase_72 TLE -
testcase_73 TLE -
testcase_74 TLE -
testcase_75 TLE -
testcase_76 TLE -
testcase_77 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

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();
		List<Integer> P = new ArrayList<Integer>();
		for (int i=0; i < N; i++) {
			P.add(scan.nextInt());
		}
		Collections.sort(P);
		List<Integer> E = new ArrayList<Integer>();
		for (int i=0; i < N; i++) {
			E.add(scan.nextInt());
		}
		Collections.sort(E);
		List<Integer> A = new ArrayList<Integer>();
		for (int i=0; i < N; i++) {
			A.add(scan.nextInt());
		}
		Collections.sort(A);
		List<Integer> H = new ArrayList<Integer>();
		for (int i=0; i < N; i++) {
			H.add(scan.nextInt());
		}
		Collections.sort(H);
		scan.close();
		long D = 0;
		long min = 0, max = 1;
		long startTime = System.currentTimeMillis();	
		for (int i=0; i < N; i++) {	
			int p = P.get(i);
			int e = E.get(i);
			min = Math.min(p, e);
			max = Math.max(p, e);
			int a = A.get(i);
			int h = H.get(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