結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー sakasu1sakasu1
提出日時 2021-01-23 13:44:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 821 bytes
コンパイル時間 2,161 ms
コンパイル使用メモリ 169,948 KB
実行使用メモリ 9,644 KB
最終ジャッジ日時 2023-08-29 00:27:15
合計ジャッジ時間 37,128 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 264 ms
6,496 KB
testcase_04 AC 244 ms
6,312 KB
testcase_05 AC 227 ms
6,140 KB
testcase_06 AC 237 ms
6,244 KB
testcase_07 AC 335 ms
7,632 KB
testcase_08 AC 336 ms
7,516 KB
testcase_09 AC 92 ms
4,380 KB
testcase_10 AC 92 ms
4,412 KB
testcase_11 AC 425 ms
8,568 KB
testcase_12 AC 425 ms
8,708 KB
testcase_13 AC 272 ms
6,776 KB
testcase_14 AC 274 ms
6,764 KB
testcase_15 AC 239 ms
6,232 KB
testcase_16 AC 239 ms
6,308 KB
testcase_17 AC 449 ms
8,832 KB
testcase_18 AC 450 ms
8,784 KB
testcase_19 AC 388 ms
8,160 KB
testcase_20 AC 389 ms
7,992 KB
testcase_21 AC 436 ms
8,608 KB
testcase_22 AC 419 ms
8,836 KB
testcase_23 AC 290 ms
6,932 KB
testcase_24 AC 295 ms
6,948 KB
testcase_25 AC 47 ms
4,376 KB
testcase_26 AC 46 ms
4,376 KB
testcase_27 AC 149 ms
5,276 KB
testcase_28 AC 151 ms
5,192 KB
testcase_29 AC 184 ms
5,436 KB
testcase_30 AC 186 ms
5,348 KB
testcase_31 AC 251 ms
6,144 KB
testcase_32 AC 246 ms
6,252 KB
testcase_33 AC 185 ms
5,520 KB
testcase_34 AC 181 ms
5,472 KB
testcase_35 AC 244 ms
6,176 KB
testcase_36 AC 240 ms
6,232 KB
testcase_37 AC 49 ms
4,376 KB
testcase_38 AC 49 ms
4,376 KB
testcase_39 AC 40 ms
4,380 KB
testcase_40 AC 40 ms
4,376 KB
testcase_41 AC 91 ms
4,380 KB
testcase_42 AC 86 ms
4,376 KB
testcase_43 AC 70 ms
4,380 KB
testcase_44 AC 451 ms
9,180 KB
testcase_45 AC 189 ms
5,420 KB
testcase_46 AC 64 ms
4,380 KB
testcase_47 AC 316 ms
7,304 KB
testcase_48 AC 303 ms
7,060 KB
testcase_49 AC 308 ms
7,256 KB
testcase_50 AC 234 ms
6,460 KB
testcase_51 AC 12 ms
4,376 KB
testcase_52 AC 401 ms
8,316 KB
testcase_53 AC 463 ms
9,304 KB
testcase_54 AC 476 ms
9,396 KB
testcase_55 AC 471 ms
9,492 KB
testcase_56 AC 475 ms
9,464 KB
testcase_57 AC 478 ms
9,404 KB
testcase_58 AC 475 ms
9,396 KB
testcase_59 AC 473 ms
9,476 KB
testcase_60 AC 467 ms
9,644 KB
testcase_61 AC 456 ms
9,368 KB
testcase_62 AC 473 ms
9,480 KB
testcase_63 AC 473 ms
9,360 KB
testcase_64 AC 474 ms
9,348 KB
testcase_65 AC 471 ms
9,356 KB
testcase_66 AC 471 ms
9,328 KB
testcase_67 AC 479 ms
9,364 KB
testcase_68 AC 466 ms
9,628 KB
testcase_69 AC 450 ms
9,380 KB
testcase_70 AC 454 ms
9,488 KB
testcase_71 AC 443 ms
9,436 KB
testcase_72 AC 476 ms
9,436 KB
testcase_73 AC 470 ms
9,320 KB
testcase_74 AC 466 ms
9,424 KB
testcase_75 AC 468 ms
9,628 KB
testcase_76 AC 464 ms
9,416 KB
testcase_77 AC 466 ms
9,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
  ll i,n,k,m;
  cin >> n >> k >> m;
  vector<ll> p(n),e(n),a(n),h(n);
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  for(i=0;i<n;i++){
    cin >> e[i];
  }
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  for(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(i=0;i<n;i++){
    ans+=modpow(max(max(p[i],e[i]),max(a[i],h[i]))-min(min(p[i],e[i]),min(a[i],h[i])),k,m);
    ans%=m;
  }
  cout << ans << endl;
}
0