結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー 夜
提出日時 2021-01-23 09:19:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 987 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 94,120 KB
実行使用メモリ 9,808 KB
最終ジャッジ日時 2023-08-28 18:07:19
合計ジャッジ時間 32,763 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,948 KB
testcase_01 AC 4 ms
4,952 KB
testcase_02 AC 3 ms
4,948 KB
testcase_03 AC 245 ms
6,744 KB
testcase_04 AC 242 ms
6,616 KB
testcase_05 AC 227 ms
6,800 KB
testcase_06 AC 227 ms
6,504 KB
testcase_07 AC 335 ms
7,932 KB
testcase_08 AC 334 ms
7,876 KB
testcase_09 AC 92 ms
5,080 KB
testcase_10 AC 92 ms
5,016 KB
testcase_11 AC 424 ms
9,028 KB
testcase_12 AC 425 ms
8,972 KB
testcase_13 AC 275 ms
7,288 KB
testcase_14 AC 274 ms
6,996 KB
testcase_15 AC 238 ms
6,544 KB
testcase_16 AC 240 ms
6,660 KB
testcase_17 AC 450 ms
9,276 KB
testcase_18 AC 450 ms
9,284 KB
testcase_19 AC 392 ms
8,472 KB
testcase_20 AC 389 ms
8,476 KB
testcase_21 AC 426 ms
9,200 KB
testcase_22 AC 419 ms
9,196 KB
testcase_23 AC 288 ms
7,332 KB
testcase_24 AC 292 ms
7,604 KB
testcase_25 AC 46 ms
5,016 KB
testcase_26 AC 46 ms
4,952 KB
testcase_27 AC 150 ms
5,328 KB
testcase_28 AC 150 ms
5,540 KB
testcase_29 AC 184 ms
5,848 KB
testcase_30 AC 184 ms
6,108 KB
testcase_31 AC 248 ms
6,636 KB
testcase_32 AC 245 ms
6,692 KB
testcase_33 AC 182 ms
5,824 KB
testcase_34 AC 183 ms
5,900 KB
testcase_35 AC 240 ms
6,544 KB
testcase_36 AC 240 ms
6,540 KB
testcase_37 AC 49 ms
5,136 KB
testcase_38 AC 49 ms
4,948 KB
testcase_39 AC 40 ms
5,016 KB
testcase_40 AC 40 ms
5,076 KB
testcase_41 AC 86 ms
5,072 KB
testcase_42 AC 87 ms
5,016 KB
testcase_43 AC 70 ms
5,024 KB
testcase_44 AC 447 ms
9,452 KB
testcase_45 AC 188 ms
5,892 KB
testcase_46 AC 64 ms
4,952 KB
testcase_47 AC 316 ms
7,620 KB
testcase_48 AC 302 ms
7,500 KB
testcase_49 AC 308 ms
7,792 KB
testcase_50 AC 236 ms
6,832 KB
testcase_51 AC 13 ms
5,020 KB
testcase_52 AC 400 ms
8,864 KB
testcase_53 AC 461 ms
9,660 KB
testcase_54 AC 476 ms
9,608 KB
testcase_55 AC 473 ms
9,604 KB
testcase_56 AC 473 ms
9,740 KB
testcase_57 AC 475 ms
9,728 KB
testcase_58 AC 475 ms
9,672 KB
testcase_59 AC 473 ms
9,692 KB
testcase_60 AC 465 ms
9,808 KB
testcase_61 AC 454 ms
9,636 KB
testcase_62 AC 470 ms
9,596 KB
testcase_63 AC 473 ms
9,600 KB
testcase_64 AC 473 ms
9,616 KB
testcase_65 AC 474 ms
9,592 KB
testcase_66 AC 469 ms
9,672 KB
testcase_67 AC 479 ms
9,656 KB
testcase_68 AC 467 ms
9,580 KB
testcase_69 AC 454 ms
9,596 KB
testcase_70 AC 453 ms
9,588 KB
testcase_71 AC 445 ms
9,628 KB
testcase_72 AC 476 ms
9,604 KB
testcase_73 AC 470 ms
9,744 KB
testcase_74 AC 464 ms
9,580 KB
testcase_75 AC 470 ms
9,744 KB
testcase_76 AC 464 ms
9,708 KB
testcase_77 AC 466 ms
9,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long p[200020], e[200020], a[200020], h[200020];
int main() {
	long long n, k, m;
	cin >> n >> k >> m;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> e[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(p, p + n);
	sort(e, e + n);
	sort(a, a + n);
	sort(h, h + n);
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long x = max({ p[i],e[i],a[i],h[i] }) - min({ p[i],e[i],a[i],h[i] });
		long long y = k;
		long long ans1 = 1;
		while (y > 0) {
			if ((y & 1) == 1) {
				ans1 = ans1 * x % m;
			}
			x = x * x % m;
			y >>= 1;
		}
		ans += ans1;
		ans %= m;
	}
	cout << ans << endl;
}
0