結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー 小野寺健小野寺健
提出日時 2021-05-26 21:14:23
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,437 bytes
コンパイル時間 5,513 ms
コンパイル使用メモリ 76,268 KB
実行使用メモリ 90,824 KB
最終ジャッジ日時 2023-08-10 11:45:00
合計ジャッジ時間 152,759 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,840 KB
testcase_01 AC 122 ms
55,848 KB
testcase_02 AC 128 ms
56,000 KB
testcase_03 AC 1,588 ms
75,080 KB
testcase_04 AC 1,565 ms
72,820 KB
testcase_05 AC 1,555 ms
74,804 KB
testcase_06 AC 1,555 ms
72,348 KB
testcase_07 AC 1,878 ms
82,880 KB
testcase_08 AC 1,877 ms
69,892 KB
testcase_09 AC 948 ms
63,880 KB
testcase_10 AC 950 ms
66,212 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,667 ms
78,184 KB
testcase_14 AC 1,641 ms
77,640 KB
testcase_15 AC 1,545 ms
74,044 KB
testcase_16 AC 1,539 ms
73,848 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 AC 1,869 ms
84,856 KB
testcase_20 AC 1,912 ms
85,480 KB
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,723 ms
76,696 KB
testcase_24 AC 1,690 ms
77,508 KB
testcase_25 AC 649 ms
62,688 KB
testcase_26 AC 637 ms
61,256 KB
testcase_27 AC 1,245 ms
71,140 KB
testcase_28 AC 1,227 ms
71,888 KB
testcase_29 AC 1,309 ms
72,544 KB
testcase_30 AC 1,333 ms
72,404 KB
testcase_31 AC 1,575 ms
74,600 KB
testcase_32 AC 1,583 ms
75,484 KB
testcase_33 AC 1,342 ms
71,616 KB
testcase_34 AC 1,335 ms
72,008 KB
testcase_35 AC 1,509 ms
74,740 KB
testcase_36 AC 1,558 ms
75,200 KB
testcase_37 AC 697 ms
61,160 KB
testcase_38 AC 695 ms
61,548 KB
testcase_39 AC 626 ms
61,080 KB
testcase_40 AC 630 ms
61,384 KB
testcase_41 AC 915 ms
66,756 KB
testcase_42 AC 894 ms
66,048 KB
testcase_43 AC 804 ms
63,944 KB
testcase_44 TLE -
testcase_45 AC 1,411 ms
72,600 KB
testcase_46 AC 751 ms
67,324 KB
testcase_47 AC 1,714 ms
77,700 KB
testcase_48 AC 1,739 ms
77,708 KB
testcase_49 AC 1,734 ms
78,596 KB
testcase_50 AC 1,506 ms
75,220 KB
testcase_51 AC 376 ms
60,632 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