結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー yakkiyakki
提出日時 2021-01-22 22:24:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 552 ms / 2,000 ms
コード長 1,332 bytes
コンパイル時間 3,767 ms
コンパイル使用メモリ 122,532 KB
実行使用メモリ 9,668 KB
最終ジャッジ日時 2023-08-27 20:07:35
合計ジャッジ時間 35,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 275 ms
6,192 KB
testcase_04 AC 273 ms
6,144 KB
testcase_05 AC 255 ms
6,144 KB
testcase_06 AC 258 ms
6,288 KB
testcase_07 AC 372 ms
7,460 KB
testcase_08 AC 372 ms
7,464 KB
testcase_09 AC 106 ms
4,376 KB
testcase_10 AC 106 ms
4,380 KB
testcase_11 AC 472 ms
8,688 KB
testcase_12 AC 473 ms
8,572 KB
testcase_13 AC 304 ms
6,860 KB
testcase_14 AC 303 ms
6,864 KB
testcase_15 AC 274 ms
6,348 KB
testcase_16 AC 273 ms
6,336 KB
testcase_17 AC 517 ms
8,952 KB
testcase_18 AC 515 ms
8,976 KB
testcase_19 AC 443 ms
8,356 KB
testcase_20 AC 443 ms
7,992 KB
testcase_21 AC 480 ms
8,868 KB
testcase_22 AC 480 ms
8,492 KB
testcase_23 AC 319 ms
7,124 KB
testcase_24 AC 321 ms
7,148 KB
testcase_25 AC 49 ms
4,376 KB
testcase_26 AC 50 ms
4,380 KB
testcase_27 AC 168 ms
4,844 KB
testcase_28 AC 167 ms
5,212 KB
testcase_29 AC 205 ms
5,496 KB
testcase_30 AC 206 ms
5,316 KB
testcase_31 AC 274 ms
6,268 KB
testcase_32 AC 274 ms
6,196 KB
testcase_33 AC 204 ms
5,564 KB
testcase_34 AC 203 ms
5,688 KB
testcase_35 AC 269 ms
6,312 KB
testcase_36 AC 268 ms
6,136 KB
testcase_37 AC 54 ms
4,380 KB
testcase_38 AC 54 ms
4,380 KB
testcase_39 AC 45 ms
4,376 KB
testcase_40 AC 45 ms
4,376 KB
testcase_41 AC 94 ms
4,376 KB
testcase_42 AC 94 ms
4,380 KB
testcase_43 AC 77 ms
4,376 KB
testcase_44 AC 493 ms
9,100 KB
testcase_45 AC 215 ms
5,544 KB
testcase_46 AC 73 ms
4,380 KB
testcase_47 AC 365 ms
7,224 KB
testcase_48 AC 329 ms
6,960 KB
testcase_49 AC 333 ms
7,160 KB
testcase_50 AC 262 ms
6,352 KB
testcase_51 AC 14 ms
4,376 KB
testcase_52 AC 445 ms
8,372 KB
testcase_53 AC 508 ms
9,364 KB
testcase_54 AC 535 ms
9,336 KB
testcase_55 AC 534 ms
9,336 KB
testcase_56 AC 530 ms
9,336 KB
testcase_57 AC 537 ms
9,364 KB
testcase_58 AC 534 ms
9,368 KB
testcase_59 AC 526 ms
9,480 KB
testcase_60 AC 514 ms
9,668 KB
testcase_61 AC 502 ms
9,272 KB
testcase_62 AC 525 ms
9,336 KB
testcase_63 AC 526 ms
9,424 KB
testcase_64 AC 535 ms
9,368 KB
testcase_65 AC 531 ms
9,444 KB
testcase_66 AC 517 ms
9,332 KB
testcase_67 AC 552 ms
9,440 KB
testcase_68 AC 524 ms
9,332 KB
testcase_69 AC 486 ms
9,284 KB
testcase_70 AC 493 ms
9,432 KB
testcase_71 AC 488 ms
9,356 KB
testcase_72 AC 538 ms
9,280 KB
testcase_73 AC 531 ms
9,280 KB
testcase_74 AC 524 ms
9,464 KB
testcase_75 AC 527 ms
9,408 KB
testcase_76 AC 520 ms
9,420 KB
testcase_77 AC 518 ms
9,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
//#define MOD 1000000007
#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll modpow(ll a, ll n, ll m){
    if(n == 0) return 1;
    ll half = modpow(a,n/2,m);
    ll res = half * half % m;
    if(n & 1) res = res * (a%m) % m;
    return res;
}

int main(){
    int n; cin >> n;
    ll k,m; cin >> k >> m;
    vector<ll> a(n),b(n),c(n),d(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
    rep(i,n) cin >> d[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    ll ans = 0;
    rep(i,n){
        ll mi = min({a[i],b[i],c[i],d[i]});
        ll Ma = max({a[i],b[i],c[i],d[i]});
        ans += modpow(Ma-mi,k,m);
        ans %= m;
    }
    cout << ans << endl;
}



0