結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー shu8Creamshu8Cream
提出日時 2021-01-22 23:10:57
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 404 ms / 2,000 ms
コード長 953 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 204,584 KB
実行使用メモリ 6,408 KB
最終ジャッジ日時 2023-08-27 22:12:31
合計ジャッジ時間 27,376 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 198 ms
4,672 KB
testcase_04 AC 200 ms
4,740 KB
testcase_05 AC 175 ms
4,576 KB
testcase_06 AC 175 ms
4,564 KB
testcase_07 AC 267 ms
5,480 KB
testcase_08 AC 268 ms
5,420 KB
testcase_09 AC 79 ms
4,380 KB
testcase_10 AC 78 ms
4,376 KB
testcase_11 AC 345 ms
5,896 KB
testcase_12 AC 348 ms
6,004 KB
testcase_13 AC 221 ms
4,976 KB
testcase_14 AC 220 ms
4,836 KB
testcase_15 AC 201 ms
4,612 KB
testcase_16 AC 202 ms
4,616 KB
testcase_17 AC 375 ms
5,936 KB
testcase_18 AC 375 ms
5,992 KB
testcase_19 AC 322 ms
5,876 KB
testcase_20 AC 323 ms
5,728 KB
testcase_21 AC 352 ms
5,740 KB
testcase_22 AC 350 ms
5,744 KB
testcase_23 AC 227 ms
4,832 KB
testcase_24 AC 228 ms
5,204 KB
testcase_25 AC 36 ms
4,380 KB
testcase_26 AC 37 ms
4,376 KB
testcase_27 AC 123 ms
4,376 KB
testcase_28 AC 122 ms
4,380 KB
testcase_29 AC 152 ms
4,380 KB
testcase_30 AC 153 ms
4,424 KB
testcase_31 AC 202 ms
4,572 KB
testcase_32 AC 202 ms
4,680 KB
testcase_33 AC 149 ms
4,476 KB
testcase_34 AC 151 ms
4,420 KB
testcase_35 AC 200 ms
4,568 KB
testcase_36 AC 198 ms
4,688 KB
testcase_37 AC 40 ms
4,376 KB
testcase_38 AC 40 ms
4,376 KB
testcase_39 AC 34 ms
4,376 KB
testcase_40 AC 33 ms
4,376 KB
testcase_41 AC 68 ms
4,380 KB
testcase_42 AC 68 ms
4,380 KB
testcase_43 AC 55 ms
4,376 KB
testcase_44 AC 363 ms
6,172 KB
testcase_45 AC 158 ms
4,380 KB
testcase_46 AC 55 ms
4,380 KB
testcase_47 AC 268 ms
5,092 KB
testcase_48 AC 238 ms
5,268 KB
testcase_49 AC 244 ms
5,088 KB
testcase_50 AC 188 ms
4,824 KB
testcase_51 AC 10 ms
4,376 KB
testcase_52 AC 328 ms
5,884 KB
testcase_53 AC 362 ms
6,216 KB
testcase_54 AC 395 ms
6,212 KB
testcase_55 AC 390 ms
6,324 KB
testcase_56 AC 399 ms
6,312 KB
testcase_57 AC 395 ms
6,260 KB
testcase_58 AC 398 ms
6,160 KB
testcase_59 AC 385 ms
6,212 KB
testcase_60 AC 372 ms
6,156 KB
testcase_61 AC 345 ms
6,164 KB
testcase_62 AC 382 ms
6,152 KB
testcase_63 AC 385 ms
6,148 KB
testcase_64 AC 388 ms
6,276 KB
testcase_65 AC 393 ms
6,200 KB
testcase_66 AC 378 ms
6,208 KB
testcase_67 AC 404 ms
6,264 KB
testcase_68 AC 375 ms
6,204 KB
testcase_69 AC 331 ms
6,408 KB
testcase_70 AC 343 ms
6,156 KB
testcase_71 AC 325 ms
6,148 KB
testcase_72 AC 390 ms
6,320 KB
testcase_73 AC 374 ms
6,272 KB
testcase_74 AC 376 ms
6,200 KB
testcase_75 AC 384 ms
6,156 KB
testcase_76 AC 370 ms
6,356 KB
testcase_77 AC 372 ms
6,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  shu8Cream
*    created: 22.01.2021 22:56:51
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

ll mod_pow(ll a, ll b, ll n){
    if(b==0) return 1;
    if(b%2!=0) return a * mod_pow(a, b-1, n) % n;
    else return mod_pow(a * a % n, b / 2, n) % n;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k,m;
    cin >> n >> k >> m;
    vi p(n),e(n),a(n),h(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> e[i];
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> h[i];
    sort(all(p));
    sort(all(e));
    sort(all(a));
    sort(all(h));
    ll ans = 0;
    rep(i,n){
        ll x = max({p[i], e[i], a[i], h[i]});
        ll y = min({p[i], e[i], a[i], h[i]});
        ans+=mod_pow(x-y,k,m);
    }
    ans%=m;
    cout << ans << endl;
}
0