結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー Nzt3Nzt3
提出日時 2021-01-22 22:26:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 1,607 ms
コンパイル使用メモリ 170,100 KB
実行使用メモリ 6,500 KB
最終ジャッジ日時 2023-08-27 20:12:44
合計ジャッジ時間 31,122 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 240 ms
4,880 KB
testcase_04 AC 239 ms
4,672 KB
testcase_05 AC 237 ms
4,732 KB
testcase_06 AC 236 ms
4,744 KB
testcase_07 AC 338 ms
5,468 KB
testcase_08 AC 339 ms
5,344 KB
testcase_09 AC 91 ms
4,376 KB
testcase_10 AC 91 ms
4,380 KB
testcase_11 AC 421 ms
5,932 KB
testcase_12 AC 422 ms
6,060 KB
testcase_13 AC 274 ms
4,952 KB
testcase_14 AC 273 ms
4,876 KB
testcase_15 AC 237 ms
4,736 KB
testcase_16 AC 238 ms
4,556 KB
testcase_17 AC 444 ms
5,984 KB
testcase_18 AC 443 ms
5,912 KB
testcase_19 AC 391 ms
5,660 KB
testcase_20 AC 388 ms
5,796 KB
testcase_21 AC 420 ms
5,608 KB
testcase_22 AC 418 ms
5,720 KB
testcase_23 AC 292 ms
5,000 KB
testcase_24 AC 292 ms
4,988 KB
testcase_25 AC 46 ms
4,376 KB
testcase_26 AC 45 ms
4,380 KB
testcase_27 AC 149 ms
4,376 KB
testcase_28 AC 148 ms
4,380 KB
testcase_29 AC 182 ms
4,380 KB
testcase_30 AC 183 ms
4,376 KB
testcase_31 AC 247 ms
4,668 KB
testcase_32 AC 246 ms
4,664 KB
testcase_33 AC 180 ms
4,376 KB
testcase_34 AC 180 ms
4,380 KB
testcase_35 AC 237 ms
4,552 KB
testcase_36 AC 240 ms
4,672 KB
testcase_37 AC 48 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,376 KB
testcase_41 AC 85 ms
4,376 KB
testcase_42 AC 85 ms
4,376 KB
testcase_43 AC 70 ms
4,380 KB
testcase_44 AC 443 ms
5,992 KB
testcase_45 AC 186 ms
4,376 KB
testcase_46 AC 63 ms
4,376 KB
testcase_47 AC 313 ms
5,216 KB
testcase_48 AC 300 ms
5,148 KB
testcase_49 AC 310 ms
5,120 KB
testcase_50 AC 236 ms
4,552 KB
testcase_51 AC 12 ms
4,380 KB
testcase_52 AC 396 ms
5,652 KB
testcase_53 AC 468 ms
6,140 KB
testcase_54 AC 470 ms
6,324 KB
testcase_55 AC 469 ms
6,264 KB
testcase_56 AC 475 ms
6,184 KB
testcase_57 AC 473 ms
6,132 KB
testcase_58 AC 470 ms
6,264 KB
testcase_59 AC 470 ms
6,132 KB
testcase_60 AC 465 ms
6,184 KB
testcase_61 AC 469 ms
6,324 KB
testcase_62 AC 469 ms
6,188 KB
testcase_63 AC 470 ms
6,500 KB
testcase_64 AC 471 ms
6,308 KB
testcase_65 AC 471 ms
6,268 KB
testcase_66 AC 468 ms
6,484 KB
testcase_67 AC 477 ms
6,180 KB
testcase_68 AC 469 ms
6,272 KB
testcase_69 AC 463 ms
6,260 KB
testcase_70 AC 467 ms
6,176 KB
testcase_71 AC 465 ms
6,316 KB
testcase_72 AC 471 ms
6,136 KB
testcase_73 AC 472 ms
6,128 KB
testcase_74 AC 469 ms
6,456 KB
testcase_75 AC 468 ms
6,180 KB
testcase_76 AC 470 ms
6,136 KB
testcase_77 AC 464 ms
6,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int64_t mod=0;
int64_t modpow(int64_t a,int n){
  int64_t ret=1,t=a;
  for(int i=0;i<31;i++){
    if(n>>i&1)ret=ret*t%mod;
    t=t*t%mod;
  }
  return ret;
}
int main(){
  int n,k;
  cin>>n>>k>>mod;
  vector<int>a(n),b(n),c(n),d(n);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  for(int i=0;i<n;i++)cin>>c[i];
  for(int i=0;i<n;i++)cin>>d[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  sort(d.begin(),d.end());
  int64_t ans=0;
  for(int i=0;i<n;i++){
    ans=(ans+modpow(max({a[i],b[i],c[i],d[i]})-min({a[i],b[i],c[i],d[i]}),k))%mod;
  }
  cout<<ans<<'\n';
}
0