結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー fumofumofunifumofumofuni
提出日時 2021-01-22 22:11:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 492 ms / 2,000 ms
コード長 1,509 bytes
コンパイル時間 4,096 ms
コンパイル使用メモリ 205,192 KB
実行使用メモリ 11,080 KB
最終ジャッジ日時 2023-08-27 19:33:17
合計ジャッジ時間 32,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 2 ms
4,356 KB
testcase_02 AC 2 ms
4,356 KB
testcase_03 AC 248 ms
7,108 KB
testcase_04 AC 248 ms
7,052 KB
testcase_05 AC 234 ms
7,052 KB
testcase_06 AC 234 ms
7,252 KB
testcase_07 AC 343 ms
8,696 KB
testcase_08 AC 343 ms
8,544 KB
testcase_09 AC 95 ms
4,640 KB
testcase_10 AC 95 ms
4,852 KB
testcase_11 AC 435 ms
10,128 KB
testcase_12 AC 439 ms
9,860 KB
testcase_13 AC 281 ms
7,536 KB
testcase_14 AC 281 ms
7,488 KB
testcase_15 AC 245 ms
6,920 KB
testcase_16 AC 245 ms
6,960 KB
testcase_17 AC 464 ms
10,392 KB
testcase_18 AC 462 ms
10,388 KB
testcase_19 AC 400 ms
9,336 KB
testcase_20 AC 402 ms
9,332 KB
testcase_21 AC 434 ms
10,012 KB
testcase_22 AC 431 ms
10,024 KB
testcase_23 AC 298 ms
8,160 KB
testcase_24 AC 299 ms
8,104 KB
testcase_25 AC 48 ms
4,356 KB
testcase_26 AC 47 ms
4,356 KB
testcase_27 AC 156 ms
5,384 KB
testcase_28 AC 154 ms
5,424 KB
testcase_29 AC 190 ms
5,904 KB
testcase_30 AC 191 ms
6,436 KB
testcase_31 AC 254 ms
6,968 KB
testcase_32 AC 253 ms
7,012 KB
testcase_33 AC 187 ms
5,904 KB
testcase_34 AC 186 ms
5,956 KB
testcase_35 AC 246 ms
7,116 KB
testcase_36 AC 246 ms
7,052 KB
testcase_37 AC 50 ms
4,352 KB
testcase_38 AC 50 ms
4,356 KB
testcase_39 AC 40 ms
4,352 KB
testcase_40 AC 41 ms
4,356 KB
testcase_41 AC 89 ms
4,472 KB
testcase_42 AC 89 ms
4,488 KB
testcase_43 AC 72 ms
4,356 KB
testcase_44 AC 462 ms
10,396 KB
testcase_45 AC 194 ms
6,264 KB
testcase_46 AC 66 ms
4,356 KB
testcase_47 AC 327 ms
8,064 KB
testcase_48 AC 312 ms
8,072 KB
testcase_49 AC 315 ms
8,364 KB
testcase_50 AC 241 ms
7,276 KB
testcase_51 AC 13 ms
4,356 KB
testcase_52 AC 412 ms
9,752 KB
testcase_53 AC 476 ms
10,884 KB
testcase_54 AC 490 ms
11,072 KB
testcase_55 AC 486 ms
10,972 KB
testcase_56 AC 489 ms
10,972 KB
testcase_57 AC 492 ms
10,876 KB
testcase_58 AC 487 ms
11,064 KB
testcase_59 AC 486 ms
11,012 KB
testcase_60 AC 481 ms
10,876 KB
testcase_61 AC 469 ms
11,008 KB
testcase_62 AC 489 ms
10,920 KB
testcase_63 AC 488 ms
11,016 KB
testcase_64 AC 488 ms
11,076 KB
testcase_65 AC 483 ms
11,080 KB
testcase_66 AC 487 ms
11,020 KB
testcase_67 AC 492 ms
11,000 KB
testcase_68 AC 480 ms
11,024 KB
testcase_69 AC 466 ms
10,872 KB
testcase_70 AC 468 ms
10,916 KB
testcase_71 AC 457 ms
10,972 KB
testcase_72 AC 490 ms
10,968 KB
testcase_73 AC 484 ms
11,072 KB
testcase_74 AC 482 ms
10,968 KB
testcase_75 AC 481 ms
10,972 KB
testcase_76 AC 481 ms
11,004 KB
testcase_77 AC 481 ms
10,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={-1,0,1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}



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

int main(){
    ll n,k,m;cin >> n >> k >>m;
    vvl v(4,vl(n));
    rep(i,4){
        rep(j,n)cin >> v[i][j];
    }
    rep(i,4)sort(all(v[i]));
    ll ans=0;
    rep(i,n){
        vl ret={v[0][i],v[1][i],v[2][i],v[3][i]};
        sort(all(ret));
        ans+=modpow(ret[3]-ret[0],k,m);
        ans%=m;
    }
    cout << ans <<endl;
} 
0