結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー ぷらぷら
提出日時 2021-01-22 21:46:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 1,142 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 171,704 KB
実行使用メモリ 9,496 KB
最終ジャッジ日時 2023-08-27 18:31:33
合計ジャッジ時間 30,933 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 241 ms
6,176 KB
testcase_04 AC 241 ms
6,224 KB
testcase_05 AC 227 ms
6,332 KB
testcase_06 AC 226 ms
6,192 KB
testcase_07 AC 334 ms
7,584 KB
testcase_08 AC 334 ms
7,580 KB
testcase_09 AC 93 ms
4,444 KB
testcase_10 AC 93 ms
4,452 KB
testcase_11 AC 425 ms
8,568 KB
testcase_12 AC 424 ms
8,600 KB
testcase_13 AC 274 ms
6,716 KB
testcase_14 AC 273 ms
6,672 KB
testcase_15 AC 238 ms
6,280 KB
testcase_16 AC 238 ms
6,268 KB
testcase_17 AC 449 ms
8,864 KB
testcase_18 AC 448 ms
8,784 KB
testcase_19 AC 391 ms
8,044 KB
testcase_20 AC 389 ms
8,148 KB
testcase_21 AC 420 ms
8,844 KB
testcase_22 AC 421 ms
8,792 KB
testcase_23 AC 290 ms
6,988 KB
testcase_24 AC 290 ms
7,128 KB
testcase_25 AC 46 ms
4,380 KB
testcase_26 AC 45 ms
4,376 KB
testcase_27 AC 150 ms
4,948 KB
testcase_28 AC 149 ms
5,272 KB
testcase_29 AC 183 ms
5,512 KB
testcase_30 AC 184 ms
5,480 KB
testcase_31 AC 246 ms
6,144 KB
testcase_32 AC 247 ms
6,140 KB
testcase_33 AC 181 ms
5,360 KB
testcase_34 AC 181 ms
5,532 KB
testcase_35 AC 239 ms
6,268 KB
testcase_36 AC 239 ms
6,192 KB
testcase_37 AC 48 ms
4,376 KB
testcase_38 AC 49 ms
4,376 KB
testcase_39 AC 40 ms
4,376 KB
testcase_40 AC 39 ms
4,376 KB
testcase_41 AC 86 ms
4,376 KB
testcase_42 AC 86 ms
4,380 KB
testcase_43 AC 70 ms
4,380 KB
testcase_44 AC 450 ms
9,084 KB
testcase_45 AC 188 ms
5,384 KB
testcase_46 AC 66 ms
4,380 KB
testcase_47 AC 317 ms
7,200 KB
testcase_48 AC 302 ms
7,020 KB
testcase_49 AC 309 ms
7,204 KB
testcase_50 AC 234 ms
6,144 KB
testcase_51 AC 12 ms
4,380 KB
testcase_52 AC 400 ms
8,256 KB
testcase_53 AC 462 ms
9,352 KB
testcase_54 AC 475 ms
9,344 KB
testcase_55 AC 472 ms
9,316 KB
testcase_56 AC 474 ms
9,316 KB
testcase_57 AC 476 ms
9,436 KB
testcase_58 AC 479 ms
9,312 KB
testcase_59 AC 473 ms
9,468 KB
testcase_60 AC 467 ms
9,312 KB
testcase_61 AC 454 ms
9,432 KB
testcase_62 AC 471 ms
9,312 KB
testcase_63 AC 473 ms
9,472 KB
testcase_64 AC 475 ms
9,316 KB
testcase_65 AC 471 ms
9,432 KB
testcase_66 AC 472 ms
9,436 KB
testcase_67 AC 481 ms
9,312 KB
testcase_68 AC 466 ms
9,412 KB
testcase_69 AC 453 ms
9,468 KB
testcase_70 AC 453 ms
9,496 KB
testcase_71 AC 444 ms
9,412 KB
testcase_72 AC 476 ms
9,312 KB
testcase_73 AC 468 ms
9,436 KB
testcase_74 AC 467 ms
9,316 KB
testcase_75 AC 469 ms
9,320 KB
testcase_76 AC 464 ms
9,356 KB
testcase_77 AC 466 ms
9,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define rrep(i,n) for(int i = int(n)-1; i >= 0; i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
int dx[] = {1, 0,-1, 0, 1, 1,-1,-1};
int dy[] = {0, 1, 0,-1, 1,-1, 1,-1};
int mod = 998244353;
int MOD = 1000000007;
int inf = 1001001001;
ll INF = 1001001001001001001;

ll mod_pow(ll x,ll y,ll m) {
    ll res = 1;
    while(y > 0) {
        if(y%2) {
            res = res*x%m;
        }
        x = x*x%m;
        y /= 2;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    ll K,M;
    cin >> K >> M;
    vector<ll>P(N),E(N),A(N),H(N);
    rep(i,N) {
        cin >> P[i];
    }
    sort(all(P));
    rep(i,N) {
        cin >> E[i];
    }
    sort(all(E));
    rep(i,N) {
        cin >> A[i];
    }
    sort(all(A));
    rep(i,N) {
        cin >> H[i];
    }
    sort(all(H));
    int ans = 0;
    rep(i,N) {
        ans += mod_pow(max({P[i],E[i],A[i],H[i]})-min({P[i],E[i],A[i],H[i]}),K,M);
        ans %= M;
    }
    cout << ans << endl;
}
0