結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー moririn2528_cmoririn2528_c
提出日時 2021-01-23 05:57:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 2,011 bytes
コンパイル時間 4,209 ms
コンパイル使用メモリ 163,380 KB
実行使用メモリ 11,252 KB
最終ジャッジ日時 2023-08-28 15:26:20
合計ジャッジ時間 36,943 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 287 ms
6,968 KB
testcase_04 AC 260 ms
7,332 KB
testcase_05 AC 241 ms
6,968 KB
testcase_06 AC 248 ms
7,020 KB
testcase_07 AC 354 ms
8,736 KB
testcase_08 AC 355 ms
8,636 KB
testcase_09 AC 99 ms
4,660 KB
testcase_10 AC 99 ms
4,780 KB
testcase_11 AC 446 ms
10,208 KB
testcase_12 AC 446 ms
10,216 KB
testcase_13 AC 288 ms
7,604 KB
testcase_14 AC 288 ms
7,564 KB
testcase_15 AC 258 ms
7,152 KB
testcase_16 AC 256 ms
6,972 KB
testcase_17 AC 486 ms
10,516 KB
testcase_18 AC 484 ms
10,580 KB
testcase_19 AC 418 ms
9,516 KB
testcase_20 AC 422 ms
9,528 KB
testcase_21 AC 459 ms
9,952 KB
testcase_22 AC 454 ms
10,060 KB
testcase_23 AC 304 ms
8,136 KB
testcase_24 AC 313 ms
8,156 KB
testcase_25 AC 51 ms
4,376 KB
testcase_26 AC 47 ms
4,380 KB
testcase_27 AC 160 ms
5,432 KB
testcase_28 AC 161 ms
5,568 KB
testcase_29 AC 195 ms
5,988 KB
testcase_30 AC 201 ms
5,952 KB
testcase_31 AC 264 ms
7,080 KB
testcase_32 AC 261 ms
7,048 KB
testcase_33 AC 193 ms
6,032 KB
testcase_34 AC 191 ms
5,912 KB
testcase_35 AC 264 ms
7,016 KB
testcase_36 AC 251 ms
7,048 KB
testcase_37 AC 53 ms
4,376 KB
testcase_38 AC 51 ms
4,376 KB
testcase_39 AC 43 ms
4,500 KB
testcase_40 AC 43 ms
4,380 KB
testcase_41 AC 88 ms
4,452 KB
testcase_42 AC 88 ms
4,456 KB
testcase_43 AC 72 ms
4,380 KB
testcase_44 AC 468 ms
10,592 KB
testcase_45 AC 203 ms
6,252 KB
testcase_46 AC 69 ms
4,568 KB
testcase_47 AC 343 ms
8,472 KB
testcase_48 AC 315 ms
8,208 KB
testcase_49 AC 315 ms
8,356 KB
testcase_50 AC 246 ms
7,004 KB
testcase_51 AC 13 ms
4,380 KB
testcase_52 AC 425 ms
9,736 KB
testcase_53 AC 477 ms
10,964 KB
testcase_54 AC 504 ms
11,052 KB
testcase_55 AC 498 ms
11,108 KB
testcase_56 AC 501 ms
11,108 KB
testcase_57 AC 509 ms
10,928 KB
testcase_58 AC 508 ms
10,924 KB
testcase_59 AC 500 ms
11,252 KB
testcase_60 AC 490 ms
11,044 KB
testcase_61 AC 477 ms
11,012 KB
testcase_62 AC 503 ms
11,100 KB
testcase_63 AC 499 ms
11,008 KB
testcase_64 AC 504 ms
11,048 KB
testcase_65 AC 496 ms
10,996 KB
testcase_66 AC 492 ms
11,108 KB
testcase_67 AC 521 ms
10,952 KB
testcase_68 AC 498 ms
11,004 KB
testcase_69 AC 465 ms
11,116 KB
testcase_70 AC 467 ms
11,052 KB
testcase_71 AC 460 ms
11,108 KB
testcase_72 AC 505 ms
10,972 KB
testcase_73 AC 375 ms
11,116 KB
testcase_74 AC 380 ms
11,036 KB
testcase_75 AC 369 ms
11,112 KB
testcase_76 AC 371 ms
11,004 KB
testcase_77 AC 368 ms
11,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

long long int pow_mod(long long int a,long long int n,long long int p=1e9+7){
    //a^n mod p
    long long int b=1,t=1;
    for(;b<=n;b<<=1);
    for(b>>=1;b>0;b>>=1){
        t*=t;
        if(t>=p)t%=p;
        if(n&b)t*=a;
        if(t>=p)t%=p;
    }
    return t;
}

namespace sol{

    void solve(){
        LL n,m,p;
        int i,j,k;
        LL a,b,c;
        cin>>n>>m>>p;
        vector<vector<LL>> v(4,vector<LL>(n));
        for(i=0;i<4;i++){
            for(j=0;j<n;j++){
                cin>>v[i][j];
            }
            sort(v[i].begin(),v[i].end());
        }
        LL s=0;
        for(i=0;i<n;i++){
            a=b=v[0][i];
            for(j=0;j<4;j++){
                a=min(a,v[j][i]);
                b=max(b,v[j][i]);
            }
            s+=pow_mod(b-a,m,p);
        }
        s%=p;
        cout<<s<<endl;
    }
}

int main(){
    sol::solve();
}
0