結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー chocoruskchocorusk
提出日時 2021-01-22 21:35:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 1,171 bytes
コンパイル時間 1,215 ms
コンパイル使用メモリ 130,620 KB
実行使用メモリ 9,748 KB
最終ジャッジ日時 2023-08-27 17:47:44
合計ジャッジ時間 29,836 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,648 KB
testcase_01 AC 2 ms
7,536 KB
testcase_02 AC 2 ms
7,544 KB
testcase_03 AC 240 ms
8,216 KB
testcase_04 AC 240 ms
8,368 KB
testcase_05 AC 227 ms
8,736 KB
testcase_06 AC 227 ms
8,756 KB
testcase_07 AC 334 ms
8,844 KB
testcase_08 AC 332 ms
8,756 KB
testcase_09 AC 93 ms
8,024 KB
testcase_10 AC 94 ms
7,904 KB
testcase_11 AC 422 ms
9,384 KB
testcase_12 AC 423 ms
9,340 KB
testcase_13 AC 272 ms
8,436 KB
testcase_14 AC 274 ms
8,628 KB
testcase_15 AC 240 ms
8,496 KB
testcase_16 AC 238 ms
8,848 KB
testcase_17 AC 448 ms
9,388 KB
testcase_18 AC 447 ms
9,476 KB
testcase_19 AC 390 ms
9,184 KB
testcase_20 AC 389 ms
9,108 KB
testcase_21 AC 422 ms
9,316 KB
testcase_22 AC 419 ms
9,208 KB
testcase_23 AC 288 ms
8,580 KB
testcase_24 AC 289 ms
8,624 KB
testcase_25 AC 47 ms
7,728 KB
testcase_26 AC 46 ms
8,020 KB
testcase_27 AC 150 ms
8,040 KB
testcase_28 AC 150 ms
8,052 KB
testcase_29 AC 183 ms
8,128 KB
testcase_30 AC 184 ms
8,320 KB
testcase_31 AC 244 ms
8,448 KB
testcase_32 AC 245 ms
8,432 KB
testcase_33 AC 182 ms
8,456 KB
testcase_34 AC 182 ms
8,140 KB
testcase_35 AC 239 ms
8,432 KB
testcase_36 AC 239 ms
8,484 KB
testcase_37 AC 49 ms
7,748 KB
testcase_38 AC 49 ms
7,752 KB
testcase_39 AC 40 ms
7,788 KB
testcase_40 AC 40 ms
7,824 KB
testcase_41 AC 86 ms
7,820 KB
testcase_42 AC 86 ms
7,884 KB
testcase_43 AC 70 ms
7,652 KB
testcase_44 AC 449 ms
9,608 KB
testcase_45 AC 188 ms
8,052 KB
testcase_46 AC 64 ms
7,848 KB
testcase_47 AC 315 ms
9,008 KB
testcase_48 AC 302 ms
8,796 KB
testcase_49 AC 306 ms
8,592 KB
testcase_50 AC 234 ms
8,552 KB
testcase_51 AC 13 ms
7,512 KB
testcase_52 AC 398 ms
9,280 KB
testcase_53 AC 461 ms
9,580 KB
testcase_54 AC 473 ms
9,680 KB
testcase_55 AC 470 ms
9,576 KB
testcase_56 AC 473 ms
9,612 KB
testcase_57 AC 477 ms
9,676 KB
testcase_58 AC 473 ms
9,668 KB
testcase_59 AC 480 ms
9,544 KB
testcase_60 AC 466 ms
9,616 KB
testcase_61 AC 453 ms
9,612 KB
testcase_62 AC 469 ms
9,580 KB
testcase_63 AC 473 ms
9,588 KB
testcase_64 AC 475 ms
9,748 KB
testcase_65 AC 474 ms
9,572 KB
testcase_66 AC 470 ms
9,580 KB
testcase_67 AC 477 ms
9,612 KB
testcase_68 AC 466 ms
9,668 KB
testcase_69 AC 451 ms
9,664 KB
testcase_70 AC 453 ms
9,576 KB
testcase_71 AC 444 ms
9,632 KB
testcase_72 AC 475 ms
9,680 KB
testcase_73 AC 468 ms
9,628 KB
testcase_74 AC 464 ms
9,564 KB
testcase_75 AC 466 ms
9,560 KB
testcase_76 AC 461 ms
9,748 KB
testcase_77 AC 464 ms
9,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
ll powmod(ll a, ll k, ll MOD){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
int main()
{
    int n, k, m; cin>>n>>k>>m;
    ll p[4][200020];
    for(int i=0; i<4; i++){
        for(int j=0; j<n; j++) cin>>p[i][j];
        sort(p[i], p[i]+n);
    }
    ll ans=0;
    for(int i=0; i<n; i++){
        ll mn=min({p[0][i], p[1][i], p[2][i], p[3][i]});
        ll mx=max({p[0][i], p[1][i], p[2][i], p[3][i]});
        ans+=powmod((mx-mn)%m, k, m);
        ans%=m;
    }
    cout<<ans<<endl;
    return 0;
}
0