結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー 👑 NachiaNachia
提出日時 2021-01-22 22:43:42
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 5,792 ms
コンパイル使用メモリ 200,520 KB
実行使用メモリ 6,852 KB
最終ジャッジ日時 2023-08-27 20:51:04
合計ジャッジ時間 24,224 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 150 ms
4,992 KB
testcase_04 AC 135 ms
5,176 KB
testcase_05 AC 125 ms
5,052 KB
testcase_06 AC 211 ms
5,052 KB
testcase_07 AC 186 ms
5,672 KB
testcase_08 AC 184 ms
5,800 KB
testcase_09 AC 51 ms
4,380 KB
testcase_10 AC 52 ms
4,380 KB
testcase_11 AC 235 ms
6,324 KB
testcase_12 AC 236 ms
6,340 KB
testcase_13 AC 151 ms
5,292 KB
testcase_14 AC 152 ms
5,292 KB
testcase_15 AC 134 ms
5,036 KB
testcase_16 AC 135 ms
4,972 KB
testcase_17 AC 254 ms
6,472 KB
testcase_18 AC 253 ms
6,496 KB
testcase_19 AC 218 ms
6,164 KB
testcase_20 AC 218 ms
6,032 KB
testcase_21 AC 339 ms
6,160 KB
testcase_22 AC 236 ms
6,160 KB
testcase_23 AC 159 ms
5,528 KB
testcase_24 AC 175 ms
5,368 KB
testcase_25 AC 26 ms
4,380 KB
testcase_26 AC 25 ms
4,380 KB
testcase_27 AC 83 ms
4,504 KB
testcase_28 AC 89 ms
4,396 KB
testcase_29 AC 102 ms
4,740 KB
testcase_30 AC 136 ms
4,676 KB
testcase_31 AC 144 ms
5,180 KB
testcase_32 AC 137 ms
5,152 KB
testcase_33 AC 143 ms
4,724 KB
testcase_34 AC 100 ms
4,720 KB
testcase_35 AC 187 ms
5,064 KB
testcase_36 AC 133 ms
4,988 KB
testcase_37 AC 29 ms
4,376 KB
testcase_38 AC 28 ms
4,376 KB
testcase_39 AC 25 ms
4,380 KB
testcase_40 AC 22 ms
4,380 KB
testcase_41 AC 131 ms
4,376 KB
testcase_42 AC 47 ms
4,380 KB
testcase_43 AC 61 ms
4,380 KB
testcase_44 AC 253 ms
6,524 KB
testcase_45 AC 106 ms
4,644 KB
testcase_46 AC 36 ms
4,384 KB
testcase_47 AC 179 ms
5,588 KB
testcase_48 AC 166 ms
5,516 KB
testcase_49 AC 169 ms
5,820 KB
testcase_50 AC 130 ms
4,976 KB
testcase_51 AC 7 ms
4,376 KB
testcase_52 AC 222 ms
6,392 KB
testcase_53 AC 254 ms
6,588 KB
testcase_54 AC 266 ms
6,720 KB
testcase_55 AC 263 ms
6,580 KB
testcase_56 AC 265 ms
6,656 KB
testcase_57 AC 268 ms
6,632 KB
testcase_58 AC 265 ms
6,808 KB
testcase_59 AC 263 ms
6,636 KB
testcase_60 AC 258 ms
6,584 KB
testcase_61 AC 246 ms
6,520 KB
testcase_62 AC 263 ms
6,520 KB
testcase_63 AC 264 ms
6,720 KB
testcase_64 AC 265 ms
6,784 KB
testcase_65 AC 263 ms
6,508 KB
testcase_66 AC 263 ms
6,572 KB
testcase_67 AC 270 ms
6,640 KB
testcase_68 AC 258 ms
6,640 KB
testcase_69 AC 246 ms
6,640 KB
testcase_70 AC 247 ms
6,852 KB
testcase_71 AC 239 ms
6,580 KB
testcase_72 AC 266 ms
6,548 KB
testcase_73 AC 262 ms
6,588 KB
testcase_74 AC 262 ms
6,524 KB
testcase_75 AC 262 ms
6,564 KB
testcase_76 AC 257 ms
6,720 KB
testcase_77 AC 258 ms
6,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

ULL powm(ULL a,ULL i,ULL m){ ULL r=1; while(i){ if(i%2) r=r*a%m; a=a*a%m; i/=2; } return r; }

int N,K,M;
int A[4][200000];

int main() {
  scanf("%d%d%d",&N,&K,&M);
  rep(i,4){ rep(j,N) scanf("%d",&A[i][j]); sort(A[i],A[i]+N); }
  ULL ans=0;
  rep(i,N){
    int x[4]; rep(j,4) x[j]=A[j][i]; sort(x,x+4);
    ans+=powm(x[3]-x[0],K,M);
  }
  ans%=M;
  printf("%llu\n",ans);
  return 0;
}
0