結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー nok0nok0
提出日時 2021-01-04 17:44:05
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 201,312 KB
実行使用メモリ 6,804 KB
最終ジャッジ日時 2023-08-26 17:33:10
合計ジャッジ時間 20,310 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 144 ms
5,068 KB
testcase_04 AC 136 ms
5,092 KB
testcase_05 AC 120 ms
5,048 KB
testcase_06 AC 119 ms
5,128 KB
testcase_07 AC 174 ms
5,700 KB
testcase_08 AC 181 ms
5,704 KB
testcase_09 AC 50 ms
4,376 KB
testcase_10 AC 52 ms
4,380 KB
testcase_11 AC 230 ms
6,308 KB
testcase_12 AC 231 ms
6,464 KB
testcase_13 AC 146 ms
5,280 KB
testcase_14 AC 152 ms
5,352 KB
testcase_15 AC 130 ms
5,172 KB
testcase_16 AC 129 ms
5,024 KB
testcase_17 AC 252 ms
6,608 KB
testcase_18 AC 256 ms
6,476 KB
testcase_19 AC 214 ms
6,232 KB
testcase_20 AC 208 ms
6,140 KB
testcase_21 AC 239 ms
6,248 KB
testcase_22 AC 230 ms
6,192 KB
testcase_23 AC 158 ms
5,400 KB
testcase_24 AC 162 ms
5,420 KB
testcase_25 AC 24 ms
4,380 KB
testcase_26 AC 24 ms
4,376 KB
testcase_27 AC 83 ms
4,468 KB
testcase_28 AC 82 ms
4,680 KB
testcase_29 AC 102 ms
4,692 KB
testcase_30 AC 109 ms
4,724 KB
testcase_31 AC 147 ms
5,076 KB
testcase_32 AC 139 ms
5,296 KB
testcase_33 AC 96 ms
4,672 KB
testcase_34 AC 97 ms
4,676 KB
testcase_35 AC 130 ms
5,048 KB
testcase_36 AC 129 ms
5,132 KB
testcase_37 AC 27 ms
4,380 KB
testcase_38 AC 26 ms
4,376 KB
testcase_39 AC 22 ms
4,376 KB
testcase_40 AC 22 ms
4,380 KB
testcase_41 AC 46 ms
4,380 KB
testcase_42 AC 48 ms
4,376 KB
testcase_43 AC 39 ms
4,380 KB
testcase_44 AC 256 ms
6,480 KB
testcase_45 AC 107 ms
4,748 KB
testcase_46 AC 35 ms
4,384 KB
testcase_47 AC 174 ms
5,540 KB
testcase_48 AC 165 ms
5,572 KB
testcase_49 AC 167 ms
5,536 KB
testcase_50 AC 125 ms
5,080 KB
testcase_51 AC 7 ms
4,376 KB
testcase_52 AC 220 ms
6,088 KB
testcase_53 AC 245 ms
6,544 KB
testcase_54 AC 258 ms
6,792 KB
testcase_55 AC 251 ms
6,568 KB
testcase_56 AC 254 ms
6,548 KB
testcase_57 AC 261 ms
6,576 KB
testcase_58 AC 257 ms
6,804 KB
testcase_59 AC 254 ms
6,564 KB
testcase_60 AC 250 ms
6,616 KB
testcase_61 AC 238 ms
6,572 KB
testcase_62 AC 260 ms
6,620 KB
testcase_63 AC 260 ms
6,620 KB
testcase_64 AC 254 ms
6,568 KB
testcase_65 AC 256 ms
6,788 KB
testcase_66 AC 254 ms
6,608 KB
testcase_67 AC 262 ms
6,592 KB
testcase_68 AC 249 ms
6,620 KB
testcase_69 AC 243 ms
6,608 KB
testcase_70 AC 239 ms
6,652 KB
testcase_71 AC 235 ms
6,552 KB
testcase_72 AC 260 ms
6,552 KB
testcase_73 AC 256 ms
6,612 KB
testcase_74 AC 248 ms
6,660 KB
testcase_75 AC 250 ms
6,660 KB
testcase_76 AC 262 ms
6,656 KB
testcase_77 AC 253 ms
6,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int i, n, k, m, res, p[200000], e[200000], a[200000], h[200000];

int modpow(long long x) {
	long long ret = 1;
	int p = k;
	while(p) {
		if(p & 1) (ret *= x) %= m;
		(x *= x) %= m;
		p >>= 1;
	}
	return (int)ret;
}

int main() {
	scanf("%d%d%d", &n, &k, &m);
	for(i = 0; i < n; i++) scanf("%d", &p[i]);
	for(i = 0; i < n; i++) scanf("%d", &e[i]);
	for(i = 0; i < n; i++) scanf("%d", &a[i]);
	for(i = 0; i < n; i++) scanf("%d", &h[i]);

	std::sort(p, p + n);
	std::sort(e, e + n);
	std::sort(a, a + n);
	std::sort(h, h + n);

	for(i = 0; i < n; i++) {
		int MAX = std::max({p[i], e[i], a[i], h[i]});
		int MIN = std::min({p[i], e[i], a[i], h[i]});
		(res += modpow(MAX - MIN)) %= m;
	}

	printf("%d\n", res);

	return 0;
}
0