結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー rokahikou1rokahikou1
提出日時 2021-01-27 23:51:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 329 ms / 2,000 ms
コード長 3,107 bytes
コンパイル時間 2,737 ms
コンパイル使用メモリ 170,284 KB
実行使用メモリ 9,572 KB
最終ジャッジ日時 2023-09-07 06:41:53
合計ジャッジ時間 31,815 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 161 ms
6,252 KB
testcase_04 AC 160 ms
6,284 KB
testcase_05 AC 146 ms
6,180 KB
testcase_06 AC 146 ms
6,276 KB
testcase_07 AC 215 ms
7,612 KB
testcase_08 AC 214 ms
7,416 KB
testcase_09 AC 62 ms
4,376 KB
testcase_10 AC 62 ms
4,424 KB
testcase_11 AC 276 ms
8,624 KB
testcase_12 AC 275 ms
8,648 KB
testcase_13 AC 178 ms
6,656 KB
testcase_14 AC 178 ms
6,660 KB
testcase_15 AC 163 ms
6,272 KB
testcase_16 AC 163 ms
6,124 KB
testcase_17 AC 307 ms
8,760 KB
testcase_18 AC 307 ms
8,900 KB
testcase_19 AC 263 ms
8,080 KB
testcase_20 AC 264 ms
7,964 KB
testcase_21 AC 286 ms
8,556 KB
testcase_22 AC 287 ms
8,624 KB
testcase_23 AC 185 ms
6,888 KB
testcase_24 AC 184 ms
7,020 KB
testcase_25 AC 29 ms
4,380 KB
testcase_26 AC 29 ms
4,376 KB
testcase_27 AC 99 ms
5,084 KB
testcase_28 AC 100 ms
5,068 KB
testcase_29 AC 120 ms
5,348 KB
testcase_30 AC 122 ms
5,464 KB
testcase_31 AC 162 ms
6,268 KB
testcase_32 AC 162 ms
6,184 KB
testcase_33 AC 118 ms
5,332 KB
testcase_34 AC 119 ms
5,492 KB
testcase_35 AC 158 ms
6,228 KB
testcase_36 AC 157 ms
6,408 KB
testcase_37 AC 32 ms
4,380 KB
testcase_38 AC 32 ms
4,380 KB
testcase_39 AC 27 ms
4,380 KB
testcase_40 AC 27 ms
4,380 KB
testcase_41 AC 54 ms
4,380 KB
testcase_42 AC 55 ms
4,380 KB
testcase_43 AC 44 ms
4,380 KB
testcase_44 AC 287 ms
9,084 KB
testcase_45 AC 127 ms
5,564 KB
testcase_46 AC 44 ms
4,376 KB
testcase_47 AC 219 ms
7,220 KB
testcase_48 AC 189 ms
7,064 KB
testcase_49 AC 190 ms
7,464 KB
testcase_50 AC 153 ms
6,324 KB
testcase_51 AC 8 ms
4,380 KB
testcase_52 AC 260 ms
8,244 KB
testcase_53 AC 292 ms
9,348 KB
testcase_54 AC 318 ms
9,452 KB
testcase_55 AC 314 ms
9,364 KB
testcase_56 AC 312 ms
9,400 KB
testcase_57 AC 320 ms
9,436 KB
testcase_58 AC 316 ms
9,292 KB
testcase_59 AC 309 ms
9,456 KB
testcase_60 AC 301 ms
9,264 KB
testcase_61 AC 290 ms
9,400 KB
testcase_62 AC 309 ms
9,288 KB
testcase_63 AC 310 ms
9,332 KB
testcase_64 AC 316 ms
9,348 KB
testcase_65 AC 313 ms
9,292 KB
testcase_66 AC 302 ms
9,400 KB
testcase_67 AC 329 ms
9,400 KB
testcase_68 AC 305 ms
9,264 KB
testcase_69 AC 274 ms
9,268 KB
testcase_70 AC 282 ms
9,400 KB
testcase_71 AC 273 ms
9,292 KB
testcase_72 AC 319 ms
9,348 KB
testcase_73 AC 309 ms
9,284 KB
testcase_74 AC 302 ms
9,300 KB
testcase_75 AC 308 ms
9,436 KB
testcase_76 AC 300 ms
9,312 KB
testcase_77 AC 300 ms
9,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define ALL(v) (v).begin(), (v).end()
#define LLA(v) (v).rbegin(), (v).rend()
#define SZ(v) (v).size()
#define INT(...)                                                               \
    int __VA_ARGS__;                                                           \
    read(__VA_ARGS__)
#define LL(...)                                                                \
    ll __VA_ARGS__;                                                            \
    read(__VA_ARGS__)
#define DOUBLE(...)                                                            \
    double __VA_ARGS__;                                                        \
    read(__VA_ARGS__)
#define CHAR(...)                                                              \
    char __VA_ARGS__;                                                          \
    read(__VA_ARGS__)
#define STRING(...)                                                            \
    string __VA_ARGS__;                                                        \
    read(__VA_ARGS__)
#define VEC(type, name, size)                                                  \
    vector<type> name(size);                                                   \
    read(name)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;
template <class T> inline vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> inline auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}

void read() {}
template <class T> inline void read(T &a) { cin >> a; }
template <class T, class S> inline void read(pair<T, S> &p) {
    read(p.first), read(p.second);
}
template <class T> inline void read(vector<T> &v) {
    for(auto &a : v)
        read(a);
}
template <class Head, class... Tail>
inline void read(Head &head, Tail &...tail) {
    read(head), read(tail...);
}
template <class T> inline void chmax(T &a, T &b) { (a < b ? a = b : a); }
template <class T> inline void chmin(T &a, T &b) { (a > b ? a = b : a); }

ll mod_pow(ll x, ll n, ll mod) {
    if(n == 0)
        return 1;
    ll res = mod_pow(x * x % mod, n / 2, mod);
    if(n & 1)
        res = res * x % mod;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    LL(n, k, m);
    VEC(ll, p, n);
    VEC(ll, e, n);
    VEC(ll, a, n);
    VEC(ll, h, n);
    sort(ALL(p));
    sort(ALL(e));
    sort(ALL(a));
    sort(ALL(h));
    ll res = 0;
    rep(i, n) {
        ll d = max(p[i], max(e[i], max(a[i], h[i]))) -
               min(p[i], min(e[i], min(a[i], h[i])));
        d = mod_pow(d, k, m);
        res = (res + d) % m;
    }
    cout << res << endl;
}
0