結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー SSRSSSRS
提出日時 2021-01-22 21:38:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 758 bytes
コンパイル時間 1,800 ms
コンパイル使用メモリ 171,920 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2023-08-27 18:01:35
合計ジャッジ時間 29,930 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 223 ms
4,888 KB
testcase_06 AC 224 ms
4,836 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 383 ms
6,452 KB
testcase_20 AC 382 ms
6,204 KB
testcase_21 AC 412 ms
6,568 KB
testcase_22 AC 411 ms
6,716 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 180 ms
4,572 KB
testcase_30 AC 180 ms
4,664 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 235 ms
4,832 KB
testcase_36 AC 237 ms
5,248 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 85 ms
4,380 KB
testcase_42 AC 85 ms
4,376 KB
testcase_43 AC 68 ms
4,380 KB
testcase_44 AC 442 ms
6,736 KB
testcase_45 AC 184 ms
4,624 KB
testcase_46 WA -
testcase_47 AC 313 ms
5,668 KB
testcase_48 AC 295 ms
5,780 KB
testcase_49 AC 299 ms
5,776 KB
testcase_50 WA -
testcase_51 AC 12 ms
4,380 KB
testcase_52 WA -
testcase_53 AC 453 ms
6,980 KB
testcase_54 AC 464 ms
6,984 KB
testcase_55 AC 463 ms
6,996 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 458 ms
6,944 KB
testcase_61 AC 444 ms
7,092 KB
testcase_62 AC 464 ms
6,944 KB
testcase_63 WA -
testcase_64 AC 466 ms
7,028 KB
testcase_65 AC 460 ms
6,976 KB
testcase_66 AC 461 ms
7,104 KB
testcase_67 WA -
testcase_68 AC 459 ms
6,944 KB
testcase_69 AC 443 ms
7,072 KB
testcase_70 WA -
testcase_71 AC 435 ms
7,072 KB
testcase_72 AC 468 ms
7,100 KB
testcase_73 AC 459 ms
7,000 KB
testcase_74 AC 458 ms
6,944 KB
testcase_75 AC 459 ms
7,104 KB
testcase_76 AC 454 ms
7,020 KB
testcase_77 AC 456 ms
7,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long b, long long MOD){
  long long ans = 1;
  while (b > 0){
    if (b % 2 == 1){
      ans *= a;
      ans %= MOD;
    }
    a *= a;
    a %= MOD;
    b /= 2;
  }
  return ans;
}
int main(){
  int N, K, M;
  cin >> N >> K >> M;
  vector<vector<int>> A(4, vector<int>(N));
  for (int i = 0; i < 4; i++){
    for (int j = 0; j < N; j++){
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < 4; i++){
    sort(A[i].begin(), A[i].end());
  }
  long long ans = 0;
  for (int i = 0; i < N; i++){
    int X = max({A[0][i], A[1][i], A[2][i], A[3][i]});
    int Y = min({A[0][i], A[1][i], A[2][i], A[3][i]});
    ans += modpow(Y - X, K, M);
    ans %= M;
  }
  cout << ans << endl;
}
0