結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,504 KB
testcase_01 AC 2 ms
7,772 KB
testcase_02 AC 2 ms
7,452 KB
testcase_03 AC 241 ms
8,720 KB
testcase_04 AC 240 ms
8,900 KB
testcase_05 AC 225 ms
8,840 KB
testcase_06 AC 226 ms
8,708 KB
testcase_07 AC 333 ms
9,060 KB
testcase_08 AC 333 ms
9,060 KB
testcase_09 AC 91 ms
8,080 KB
testcase_10 AC 92 ms
8,064 KB
testcase_11 AC 422 ms
9,516 KB
testcase_12 AC 419 ms
9,420 KB
testcase_13 AC 276 ms
8,900 KB
testcase_14 AC 272 ms
8,896 KB
testcase_15 AC 236 ms
9,032 KB
testcase_16 AC 238 ms
8,844 KB
testcase_17 AC 446 ms
9,468 KB
testcase_18 AC 446 ms
9,428 KB
testcase_19 AC 388 ms
9,264 KB
testcase_20 AC 386 ms
9,216 KB
testcase_21 AC 419 ms
9,288 KB
testcase_22 AC 418 ms
9,300 KB
testcase_23 AC 287 ms
8,992 KB
testcase_24 AC 288 ms
8,900 KB
testcase_25 AC 46 ms
8,076 KB
testcase_26 AC 45 ms
7,884 KB
testcase_27 AC 149 ms
8,420 KB
testcase_28 AC 148 ms
8,416 KB
testcase_29 AC 182 ms
8,540 KB
testcase_30 AC 182 ms
8,556 KB
testcase_31 AC 244 ms
8,804 KB
testcase_32 AC 243 ms
8,868 KB
testcase_33 AC 180 ms
8,848 KB
testcase_34 AC 181 ms
8,716 KB
testcase_35 AC 238 ms
8,720 KB
testcase_36 AC 237 ms
8,728 KB
testcase_37 AC 49 ms
7,980 KB
testcase_38 AC 49 ms
7,760 KB
testcase_39 AC 40 ms
7,728 KB
testcase_40 AC 40 ms
7,768 KB
testcase_41 AC 86 ms
8,016 KB
testcase_42 AC 86 ms
8,212 KB
testcase_43 AC 70 ms
7,920 KB
testcase_44 AC 444 ms
9,584 KB
testcase_45 AC 187 ms
8,544 KB
testcase_46 AC 64 ms
7,932 KB
testcase_47 AC 314 ms
8,956 KB
testcase_48 AC 301 ms
8,936 KB
testcase_49 AC 307 ms
9,028 KB
testcase_50 AC 233 ms
8,704 KB
testcase_51 AC 13 ms
7,812 KB
testcase_52 AC 398 ms
9,316 KB
testcase_53 AC 458 ms
9,788 KB
testcase_54 AC 471 ms
9,624 KB
testcase_55 AC 467 ms
9,656 KB
testcase_56 AC 471 ms
9,596 KB
testcase_57 AC 476 ms
9,600 KB
testcase_58 AC 475 ms
9,604 KB
testcase_59 AC 472 ms
9,668 KB
testcase_60 AC 463 ms
9,724 KB
testcase_61 AC 453 ms
9,588 KB
testcase_62 AC 468 ms
9,676 KB
testcase_63 AC 470 ms
9,604 KB
testcase_64 AC 470 ms
9,600 KB
testcase_65 AC 468 ms
9,620 KB
testcase_66 AC 468 ms
9,732 KB
testcase_67 AC 475 ms
9,804 KB
testcase_68 AC 463 ms
9,600 KB
testcase_69 AC 447 ms
9,600 KB
testcase_70 AC 450 ms
9,596 KB
testcase_71 AC 442 ms
9,604 KB
testcase_72 AC 472 ms
9,596 KB
testcase_73 AC 465 ms
9,624 KB
testcase_74 AC 462 ms
9,664 KB
testcase_75 AC 463 ms
9,660 KB
testcase_76 AC 460 ms
9,800 KB
testcase_77 AC 462 ms
9,664 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