結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー monnumonnu
提出日時 2021-01-23 01:29:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 486 ms / 2,000 ms
コード長 912 bytes
コンパイル時間 2,421 ms
コンパイル使用メモリ 171,732 KB
実行使用メモリ 9,464 KB
最終ジャッジ日時 2023-08-28 10:33:10
合計ジャッジ時間 33,085 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 245 ms
6,188 KB
testcase_04 AC 244 ms
6,224 KB
testcase_05 AC 230 ms
6,120 KB
testcase_06 AC 230 ms
6,388 KB
testcase_07 AC 337 ms
7,500 KB
testcase_08 AC 339 ms
7,544 KB
testcase_09 AC 93 ms
4,376 KB
testcase_10 AC 93 ms
4,376 KB
testcase_11 AC 429 ms
8,576 KB
testcase_12 AC 428 ms
8,488 KB
testcase_13 AC 275 ms
6,752 KB
testcase_14 AC 276 ms
6,764 KB
testcase_15 AC 241 ms
6,224 KB
testcase_16 AC 241 ms
6,156 KB
testcase_17 AC 453 ms
8,860 KB
testcase_18 AC 454 ms
8,792 KB
testcase_19 AC 393 ms
7,968 KB
testcase_20 AC 394 ms
7,968 KB
testcase_21 AC 426 ms
8,608 KB
testcase_22 AC 439 ms
8,580 KB
testcase_23 AC 294 ms
6,996 KB
testcase_24 AC 292 ms
7,032 KB
testcase_25 AC 47 ms
4,376 KB
testcase_26 AC 46 ms
4,376 KB
testcase_27 AC 151 ms
4,864 KB
testcase_28 AC 151 ms
4,904 KB
testcase_29 AC 186 ms
5,588 KB
testcase_30 AC 186 ms
5,380 KB
testcase_31 AC 250 ms
6,224 KB
testcase_32 AC 248 ms
6,224 KB
testcase_33 AC 183 ms
5,472 KB
testcase_34 AC 183 ms
5,320 KB
testcase_35 AC 242 ms
6,200 KB
testcase_36 AC 242 ms
6,244 KB
testcase_37 AC 49 ms
4,376 KB
testcase_38 AC 49 ms
4,376 KB
testcase_39 AC 40 ms
4,376 KB
testcase_40 AC 40 ms
4,380 KB
testcase_41 AC 87 ms
4,380 KB
testcase_42 AC 86 ms
4,380 KB
testcase_43 AC 70 ms
4,376 KB
testcase_44 AC 455 ms
9,128 KB
testcase_45 AC 190 ms
5,432 KB
testcase_46 AC 65 ms
4,380 KB
testcase_47 AC 320 ms
7,216 KB
testcase_48 AC 306 ms
7,180 KB
testcase_49 AC 310 ms
7,296 KB
testcase_50 AC 236 ms
6,224 KB
testcase_51 AC 13 ms
4,380 KB
testcase_52 AC 403 ms
8,292 KB
testcase_53 AC 466 ms
9,276 KB
testcase_54 AC 480 ms
9,376 KB
testcase_55 AC 477 ms
9,380 KB
testcase_56 AC 482 ms
9,280 KB
testcase_57 AC 483 ms
9,440 KB
testcase_58 AC 481 ms
9,292 KB
testcase_59 AC 479 ms
9,464 KB
testcase_60 AC 474 ms
9,344 KB
testcase_61 AC 461 ms
9,344 KB
testcase_62 AC 482 ms
9,368 KB
testcase_63 AC 477 ms
9,372 KB
testcase_64 AC 480 ms
9,436 KB
testcase_65 AC 476 ms
9,388 KB
testcase_66 AC 478 ms
9,284 KB
testcase_67 AC 486 ms
9,364 KB
testcase_68 AC 478 ms
9,392 KB
testcase_69 AC 457 ms
9,380 KB
testcase_70 AC 460 ms
9,396 KB
testcase_71 AC 448 ms
9,368 KB
testcase_72 AC 482 ms
9,380 KB
testcase_73 AC 475 ms
9,392 KB
testcase_74 AC 471 ms
9,392 KB
testcase_75 AC 473 ms
9,368 KB
testcase_76 AC 470 ms
9,392 KB
testcase_77 AC 472 ms
9,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MOD 998244353
#define INF 1000000000000000000
#define MAX 2000

ll modpow(ll a,ll x,ll mod){
  a%=mod;
  ll ret=1;
  while(x>0){
    if((x&1)==1){
      ret=ret*a%mod;
    }
    a=a*a%mod;
    x>>=1;
  }
  return ret;
}

int main(){
  int N;
  ll M,K;
  cin>>N>>K>>M;
  vector<ll> P(N),E(N),A(N),H(N);
  for(int i=0;i<N;i++){
    cin>>P[i];
  }
  for(int i=0;i<N;i++){
    cin>>E[i];
  }
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  sort(P.begin(),P.end());
  sort(E.begin(),E.end());
  sort(A.begin(),A.end());
  sort(H.begin(),H.end());

  ll ans=0;
  for(int i=0;i<N;i++){
    ll d=max<ll>({P[i],E[i],A[i],H[i]})-min<ll>({P[i],E[i],A[i],H[i]});
    ans+=modpow(d,K,M);
    ans%=M;
  }
  cout<<ans<<endl;

}
0