結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー nikkukunnikkukun
提出日時 2021-01-22 21:42:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 1,013 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 171,452 KB
実行使用メモリ 6,792 KB
最終ジャッジ日時 2023-08-27 18:17:36
合計ジャッジ時間 21,507 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 157 ms
5,008 KB
testcase_04 AC 149 ms
5,112 KB
testcase_05 AC 135 ms
5,168 KB
testcase_06 AC 135 ms
5,032 KB
testcase_07 AC 202 ms
5,636 KB
testcase_08 AC 201 ms
5,708 KB
testcase_09 AC 57 ms
4,376 KB
testcase_10 AC 57 ms
4,380 KB
testcase_11 AC 259 ms
6,332 KB
testcase_12 AC 262 ms
6,184 KB
testcase_13 AC 167 ms
5,244 KB
testcase_14 AC 167 ms
5,200 KB
testcase_15 AC 147 ms
5,080 KB
testcase_16 AC 147 ms
5,056 KB
testcase_17 AC 277 ms
6,372 KB
testcase_18 AC 279 ms
6,328 KB
testcase_19 AC 242 ms
6,004 KB
testcase_20 AC 242 ms
5,928 KB
testcase_21 AC 260 ms
6,196 KB
testcase_22 AC 259 ms
6,132 KB
testcase_23 AC 176 ms
5,392 KB
testcase_24 AC 176 ms
5,404 KB
testcase_25 AC 28 ms
4,380 KB
testcase_26 AC 29 ms
4,380 KB
testcase_27 AC 91 ms
4,380 KB
testcase_28 AC 92 ms
4,432 KB
testcase_29 AC 113 ms
4,676 KB
testcase_30 AC 113 ms
4,560 KB
testcase_31 AC 151 ms
5,088 KB
testcase_32 AC 150 ms
5,088 KB
testcase_33 AC 111 ms
4,712 KB
testcase_34 AC 111 ms
4,616 KB
testcase_35 AC 147 ms
5,100 KB
testcase_36 AC 148 ms
5,112 KB
testcase_37 AC 30 ms
4,376 KB
testcase_38 AC 30 ms
4,380 KB
testcase_39 AC 24 ms
4,376 KB
testcase_40 AC 25 ms
4,376 KB
testcase_41 AC 53 ms
4,376 KB
testcase_42 AC 53 ms
4,376 KB
testcase_43 AC 42 ms
4,380 KB
testcase_44 AC 277 ms
6,436 KB
testcase_45 AC 116 ms
4,656 KB
testcase_46 AC 40 ms
4,376 KB
testcase_47 AC 196 ms
5,444 KB
testcase_48 AC 184 ms
5,436 KB
testcase_49 AC 185 ms
5,444 KB
testcase_50 AC 142 ms
5,016 KB
testcase_51 AC 8 ms
4,380 KB
testcase_52 AC 246 ms
6,028 KB
testcase_53 AC 280 ms
6,568 KB
testcase_54 AC 294 ms
6,480 KB
testcase_55 AC 288 ms
6,480 KB
testcase_56 AC 291 ms
6,560 KB
testcase_57 AC 297 ms
6,676 KB
testcase_58 AC 292 ms
6,704 KB
testcase_59 AC 289 ms
6,480 KB
testcase_60 AC 284 ms
6,624 KB
testcase_61 AC 271 ms
6,560 KB
testcase_62 AC 289 ms
6,532 KB
testcase_63 AC 290 ms
6,512 KB
testcase_64 AC 292 ms
6,488 KB
testcase_65 AC 288 ms
6,484 KB
testcase_66 AC 288 ms
6,484 KB
testcase_67 AC 295 ms
6,484 KB
testcase_68 AC 283 ms
6,612 KB
testcase_69 AC 268 ms
6,480 KB
testcase_70 AC 270 ms
6,528 KB
testcase_71 AC 261 ms
6,612 KB
testcase_72 AC 292 ms
6,792 KB
testcase_73 AC 285 ms
6,520 KB
testcase_74 AC 282 ms
6,576 KB
testcase_75 AC 286 ms
6,644 KB
testcase_76 AC 282 ms
6,548 KB
testcase_77 AC 283 ms
6,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;
typedef tuple<int, int, int> tint;

const int N = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

int MOD;

ll qpow(ll bas, int t) {
	ll ret = 1;
	while (t) {
		if (t & 1) ret = ret * bas % MOD;
		bas = bas * bas % MOD;
		t >>= 1;
	}
	return ret;
}

int a[4][N];

int main() {
	ios::sync_with_stdio(0);

	int n, m;
	cin >> n >> m >> MOD;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < n; j++)
			cin >> a[i][j];
		sort(a[i], a[i] + n);
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		vector<int> tmp;
		for (int j = 0; j < 4; j++)
			tmp.push_back(a[j][i]);
		sort(all(tmp));
		ll det = (tmp.back() - tmp.front()) % MOD;
		ans += qpow(det, m);
	}

	ans = (ans % MOD + MOD) % MOD;
	cout << ans << endl;

	return 0;
}
0