結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー moririn2528_cmoririn2528_c
提出日時 2021-01-23 05:58:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 1,964 bytes
コンパイル時間 2,574 ms
コンパイル使用メモリ 101,928 KB
実行使用メモリ 11,212 KB
最終ジャッジ日時 2023-08-28 15:27:59
合計ジャッジ時間 33,308 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 260 ms
7,104 KB
testcase_04 AC 259 ms
6,960 KB
testcase_05 AC 242 ms
7,260 KB
testcase_06 AC 242 ms
6,988 KB
testcase_07 AC 354 ms
8,548 KB
testcase_08 AC 353 ms
8,672 KB
testcase_09 AC 99 ms
4,632 KB
testcase_10 AC 99 ms
4,760 KB
testcase_11 AC 448 ms
10,308 KB
testcase_12 AC 448 ms
9,820 KB
testcase_13 AC 288 ms
7,492 KB
testcase_14 AC 290 ms
7,632 KB
testcase_15 AC 259 ms
6,964 KB
testcase_16 AC 257 ms
7,136 KB
testcase_17 AC 488 ms
10,540 KB
testcase_18 AC 487 ms
10,352 KB
testcase_19 AC 419 ms
9,404 KB
testcase_20 AC 419 ms
9,392 KB
testcase_21 AC 464 ms
9,824 KB
testcase_22 AC 455 ms
9,984 KB
testcase_23 AC 303 ms
7,764 KB
testcase_24 AC 320 ms
7,708 KB
testcase_25 AC 47 ms
4,384 KB
testcase_26 AC 47 ms
4,380 KB
testcase_27 AC 159 ms
5,332 KB
testcase_28 AC 159 ms
5,404 KB
testcase_29 AC 193 ms
6,048 KB
testcase_30 AC 198 ms
5,908 KB
testcase_31 AC 263 ms
7,552 KB
testcase_32 AC 260 ms
6,912 KB
testcase_33 AC 194 ms
6,048 KB
testcase_34 AC 193 ms
6,084 KB
testcase_35 AC 259 ms
7,020 KB
testcase_36 AC 256 ms
7,080 KB
testcase_37 AC 53 ms
4,380 KB
testcase_38 AC 51 ms
4,380 KB
testcase_39 AC 42 ms
4,380 KB
testcase_40 AC 42 ms
4,380 KB
testcase_41 AC 90 ms
4,380 KB
testcase_42 AC 89 ms
4,648 KB
testcase_43 AC 72 ms
4,376 KB
testcase_44 AC 471 ms
10,516 KB
testcase_45 AC 203 ms
6,312 KB
testcase_46 AC 69 ms
4,380 KB
testcase_47 AC 344 ms
7,976 KB
testcase_48 AC 313 ms
8,084 KB
testcase_49 AC 319 ms
8,244 KB
testcase_50 AC 248 ms
6,964 KB
testcase_51 AC 13 ms
4,376 KB
testcase_52 AC 423 ms
9,604 KB
testcase_53 AC 484 ms
10,948 KB
testcase_54 AC 507 ms
11,040 KB
testcase_55 AC 503 ms
10,928 KB
testcase_56 AC 503 ms
10,928 KB
testcase_57 AC 511 ms
11,064 KB
testcase_58 AC 507 ms
10,924 KB
testcase_59 AC 499 ms
10,880 KB
testcase_60 AC 490 ms
10,872 KB
testcase_61 AC 475 ms
10,972 KB
testcase_62 AC 500 ms
10,928 KB
testcase_63 AC 499 ms
10,924 KB
testcase_64 AC 505 ms
10,972 KB
testcase_65 AC 504 ms
10,976 KB
testcase_66 AC 493 ms
10,980 KB
testcase_67 AC 520 ms
10,972 KB
testcase_68 AC 497 ms
10,920 KB
testcase_69 AC 465 ms
11,212 KB
testcase_70 AC 470 ms
10,920 KB
testcase_71 AC 463 ms
11,056 KB
testcase_72 AC 508 ms
10,996 KB
testcase_73 AC 373 ms
10,972 KB
testcase_74 AC 374 ms
10,924 KB
testcase_75 AC 374 ms
11,044 KB
testcase_76 AC 372 ms
10,972 KB
testcase_77 AC 372 ms
11,064 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>
using namespace std;
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