結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー suzuken_wsuzuken_w
提出日時 2021-01-22 22:29:41
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 1,492 bytes
コンパイル時間 3,559 ms
コンパイル使用メモリ 217,240 KB
実行使用メモリ 11,116 KB
最終ジャッジ日時 2023-08-27 20:20:34
合計ジャッジ時間 22,869 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 143 ms
6,924 KB
testcase_04 AC 143 ms
6,956 KB
testcase_05 AC 130 ms
7,056 KB
testcase_06 AC 131 ms
7,048 KB
testcase_07 AC 194 ms
8,636 KB
testcase_08 AC 197 ms
8,644 KB
testcase_09 AC 55 ms
4,552 KB
testcase_10 AC 55 ms
4,688 KB
testcase_11 AC 253 ms
10,224 KB
testcase_12 AC 253 ms
10,384 KB
testcase_13 AC 161 ms
7,568 KB
testcase_14 AC 161 ms
7,480 KB
testcase_15 AC 141 ms
7,056 KB
testcase_16 AC 142 ms
7,056 KB
testcase_17 AC 267 ms
10,496 KB
testcase_18 AC 269 ms
10,356 KB
testcase_19 AC 231 ms
9,600 KB
testcase_20 AC 231 ms
9,440 KB
testcase_21 AC 248 ms
10,016 KB
testcase_22 AC 253 ms
10,020 KB
testcase_23 AC 169 ms
8,104 KB
testcase_24 AC 169 ms
8,116 KB
testcase_25 AC 28 ms
4,380 KB
testcase_26 AC 27 ms
4,384 KB
testcase_27 AC 88 ms
5,532 KB
testcase_28 AC 92 ms
5,480 KB
testcase_29 AC 109 ms
6,260 KB
testcase_30 AC 109 ms
6,216 KB
testcase_31 AC 144 ms
7,308 KB
testcase_32 AC 147 ms
7,240 KB
testcase_33 AC 107 ms
5,872 KB
testcase_34 AC 108 ms
6,008 KB
testcase_35 AC 141 ms
7,056 KB
testcase_36 AC 141 ms
7,112 KB
testcase_37 AC 30 ms
4,380 KB
testcase_38 AC 29 ms
4,380 KB
testcase_39 AC 24 ms
4,380 KB
testcase_40 AC 23 ms
4,380 KB
testcase_41 AC 51 ms
4,780 KB
testcase_42 AC 51 ms
4,424 KB
testcase_43 AC 40 ms
4,424 KB
testcase_44 AC 263 ms
10,384 KB
testcase_45 AC 112 ms
6,272 KB
testcase_46 AC 38 ms
4,380 KB
testcase_47 AC 191 ms
8,272 KB
testcase_48 AC 176 ms
8,012 KB
testcase_49 AC 179 ms
8,380 KB
testcase_50 AC 137 ms
7,216 KB
testcase_51 AC 8 ms
4,380 KB
testcase_52 AC 235 ms
9,676 KB
testcase_53 AC 266 ms
10,964 KB
testcase_54 AC 279 ms
10,888 KB
testcase_55 AC 277 ms
10,908 KB
testcase_56 AC 280 ms
10,888 KB
testcase_57 AC 282 ms
11,024 KB
testcase_58 AC 280 ms
11,016 KB
testcase_59 AC 278 ms
11,016 KB
testcase_60 AC 274 ms
11,024 KB
testcase_61 AC 262 ms
11,076 KB
testcase_62 AC 279 ms
11,116 KB
testcase_63 AC 279 ms
10,904 KB
testcase_64 AC 280 ms
11,016 KB
testcase_65 AC 277 ms
11,020 KB
testcase_66 AC 277 ms
10,888 KB
testcase_67 AC 284 ms
11,024 KB
testcase_68 AC 273 ms
10,908 KB
testcase_69 AC 259 ms
11,076 KB
testcase_70 AC 258 ms
11,064 KB
testcase_71 AC 249 ms
10,888 KB
testcase_72 AC 281 ms
11,020 KB
testcase_73 AC 274 ms
10,976 KB
testcase_74 AC 271 ms
11,024 KB
testcase_75 AC 271 ms
11,064 KB
testcase_76 AC 271 ms
11,072 KB
testcase_77 AC 273 ms
10,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
ll modpow(ll a,ll n,ll m){
      ll res=1;
      while(n){
           if(n&1){
                res*=a;
                res%=m;
           }
           a*=a;
           a%=m;
           n>>=1;
      }
      return res;
}
int main(){
  ll n,k,m;
  cin>>n>>k>>m;
  V<V<ll>> d(4,V<ll>(n));
  for(int i=0;i<4;i++){
      for(int j=0;j<n;j++)cin>>d[i][j];
      sort(all(d[i]));
  }
  ll ans=0;
  for(int i=0;i<n;i++){
      ll ma=0,mi=inf;
      for(int j=0;j<4;j++){
        chmax(ma,d[j][i]);
        chmin(mi,d[j][i]);
      }
      ans+=modpow(ma-mi,k,m);
      ans%=m;
  }
  cout<<ans<<"\n";
}
0