結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー mugen_1337mugen_1337
提出日時 2021-01-22 21:41:35
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 1,472 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 205,312 KB
実行使用メモリ 9,428 KB
最終ジャッジ日時 2023-08-27 18:15:12
合計ジャッジ時間 21,272 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 139 ms
6,196 KB
testcase_04 AC 139 ms
6,196 KB
testcase_05 AC 126 ms
6,236 KB
testcase_06 AC 126 ms
6,172 KB
testcase_07 AC 190 ms
7,556 KB
testcase_08 AC 190 ms
7,560 KB
testcase_09 AC 53 ms
4,376 KB
testcase_10 AC 54 ms
4,376 KB
testcase_11 AC 245 ms
8,636 KB
testcase_12 AC 244 ms
8,628 KB
testcase_13 AC 156 ms
6,728 KB
testcase_14 AC 156 ms
6,724 KB
testcase_15 AC 138 ms
6,252 KB
testcase_16 AC 139 ms
6,396 KB
testcase_17 AC 262 ms
8,892 KB
testcase_18 AC 260 ms
8,884 KB
testcase_19 AC 225 ms
7,980 KB
testcase_20 AC 225 ms
8,088 KB
testcase_21 AC 243 ms
8,528 KB
testcase_22 AC 242 ms
8,808 KB
testcase_23 AC 164 ms
6,992 KB
testcase_24 AC 164 ms
7,048 KB
testcase_25 AC 26 ms
4,380 KB
testcase_26 AC 26 ms
4,380 KB
testcase_27 AC 86 ms
5,088 KB
testcase_28 AC 86 ms
5,064 KB
testcase_29 AC 109 ms
5,456 KB
testcase_30 AC 105 ms
5,456 KB
testcase_31 AC 141 ms
6,240 KB
testcase_32 AC 141 ms
6,160 KB
testcase_33 AC 104 ms
5,360 KB
testcase_34 AC 104 ms
5,400 KB
testcase_35 AC 138 ms
6,256 KB
testcase_36 AC 137 ms
6,168 KB
testcase_37 AC 28 ms
4,380 KB
testcase_38 AC 29 ms
4,380 KB
testcase_39 AC 23 ms
4,380 KB
testcase_40 AC 23 ms
4,376 KB
testcase_41 AC 50 ms
4,380 KB
testcase_42 AC 49 ms
4,380 KB
testcase_43 AC 39 ms
4,380 KB
testcase_44 AC 256 ms
9,140 KB
testcase_45 AC 109 ms
5,372 KB
testcase_46 AC 38 ms
4,380 KB
testcase_47 AC 184 ms
7,224 KB
testcase_48 AC 171 ms
7,004 KB
testcase_49 AC 173 ms
7,480 KB
testcase_50 AC 133 ms
6,160 KB
testcase_51 AC 8 ms
4,376 KB
testcase_52 AC 231 ms
8,368 KB
testcase_53 AC 260 ms
9,288 KB
testcase_54 AC 273 ms
9,336 KB
testcase_55 AC 271 ms
9,384 KB
testcase_56 AC 274 ms
9,300 KB
testcase_57 AC 276 ms
9,360 KB
testcase_58 AC 275 ms
9,292 KB
testcase_59 AC 274 ms
9,288 KB
testcase_60 AC 268 ms
9,288 KB
testcase_61 AC 254 ms
9,384 KB
testcase_62 AC 272 ms
9,304 KB
testcase_63 AC 272 ms
9,320 KB
testcase_64 AC 274 ms
9,288 KB
testcase_65 AC 271 ms
9,428 KB
testcase_66 AC 271 ms
9,320 KB
testcase_67 AC 280 ms
9,360 KB
testcase_68 AC 267 ms
9,288 KB
testcase_69 AC 250 ms
9,336 KB
testcase_70 AC 253 ms
9,304 KB
testcase_71 AC 243 ms
9,300 KB
testcase_72 AC 275 ms
9,380 KB
testcase_73 AC 270 ms
9,328 KB
testcase_74 AC 266 ms
9,392 KB
testcase_75 AC 268 ms
9,384 KB
testcase_76 AC 264 ms
9,336 KB
testcase_77 AC 265 ms
9,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

// a^n (mod m)
ll pow_mod(ll a,ll n,ll m){
    ll ret=1;
    while(n){
        if(n&1) ret=ret*a%m;
        a=(a*a)%m;
        n/=2;
    }
    return ret;
}

signed main(){
    int n;ll k,m;cin>>n>>k>>m;
    vector<ll> a(n),b(n),c(n),d(n);
    cin>>a>>b>>c>>d;
    sort(ALL(a));sort(ALL(b));sort(ALL(c));sort(ALL(d));

    ll ans=0;
    rep(i,n){
        ll ma=max({a[i],b[i],c[i],d[i]}),mi=min({a[i],b[i],c[i],d[i]});
        ans+=pow_mod(ma-mi,k,m);
        ans%=m;
    }
    cout<<ans<<endl;
    return 0;
}
0