結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー firiexpfiriexp
提出日時 2021-01-22 21:31:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 2,095 bytes
コンパイル時間 1,314 ms
コンパイル使用メモリ 105,820 KB
実行使用メモリ 6,416 KB
最終ジャッジ日時 2023-08-27 17:41:02
合計ジャッジ時間 19,390 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 125 ms
4,728 KB
testcase_04 AC 123 ms
4,620 KB
testcase_05 AC 117 ms
4,648 KB
testcase_06 AC 118 ms
4,532 KB
testcase_07 AC 171 ms
5,376 KB
testcase_08 AC 174 ms
5,520 KB
testcase_09 AC 49 ms
4,376 KB
testcase_10 AC 48 ms
4,380 KB
testcase_11 AC 217 ms
6,000 KB
testcase_12 AC 222 ms
5,860 KB
testcase_13 AC 139 ms
4,832 KB
testcase_14 AC 142 ms
4,920 KB
testcase_15 AC 123 ms
4,620 KB
testcase_16 AC 123 ms
4,728 KB
testcase_17 AC 233 ms
5,920 KB
testcase_18 AC 237 ms
5,880 KB
testcase_19 AC 199 ms
5,676 KB
testcase_20 AC 202 ms
5,676 KB
testcase_21 AC 219 ms
5,620 KB
testcase_22 AC 216 ms
5,612 KB
testcase_23 AC 149 ms
4,948 KB
testcase_24 AC 144 ms
4,976 KB
testcase_25 AC 23 ms
4,380 KB
testcase_26 AC 23 ms
4,376 KB
testcase_27 AC 77 ms
4,376 KB
testcase_28 AC 76 ms
4,376 KB
testcase_29 AC 94 ms
4,424 KB
testcase_30 AC 94 ms
4,464 KB
testcase_31 AC 128 ms
4,720 KB
testcase_32 AC 126 ms
4,528 KB
testcase_33 AC 97 ms
4,380 KB
testcase_34 AC 91 ms
4,420 KB
testcase_35 AC 125 ms
4,572 KB
testcase_36 AC 126 ms
4,672 KB
testcase_37 AC 26 ms
4,376 KB
testcase_38 AC 26 ms
4,376 KB
testcase_39 AC 19 ms
4,380 KB
testcase_40 AC 21 ms
4,376 KB
testcase_41 AC 42 ms
4,380 KB
testcase_42 AC 42 ms
4,380 KB
testcase_43 AC 36 ms
4,376 KB
testcase_44 AC 230 ms
5,852 KB
testcase_45 AC 98 ms
4,464 KB
testcase_46 AC 34 ms
4,376 KB
testcase_47 AC 168 ms
5,120 KB
testcase_48 AC 161 ms
5,388 KB
testcase_49 AC 160 ms
5,252 KB
testcase_50 AC 120 ms
4,580 KB
testcase_51 AC 7 ms
4,380 KB
testcase_52 AC 205 ms
5,628 KB
testcase_53 AC 243 ms
6,116 KB
testcase_54 AC 247 ms
6,156 KB
testcase_55 AC 247 ms
6,232 KB
testcase_56 AC 250 ms
6,236 KB
testcase_57 AC 251 ms
6,184 KB
testcase_58 AC 251 ms
6,128 KB
testcase_59 AC 249 ms
6,416 KB
testcase_60 AC 245 ms
6,208 KB
testcase_61 AC 233 ms
6,188 KB
testcase_62 AC 249 ms
6,316 KB
testcase_63 AC 249 ms
6,144 KB
testcase_64 AC 253 ms
6,404 KB
testcase_65 AC 249 ms
6,204 KB
testcase_66 AC 252 ms
6,144 KB
testcase_67 AC 260 ms
6,204 KB
testcase_68 AC 246 ms
6,148 KB
testcase_69 AC 230 ms
6,312 KB
testcase_70 AC 230 ms
6,152 KB
testcase_71 AC 225 ms
6,168 KB
testcase_72 AC 250 ms
6,180 KB
testcase_73 AC 246 ms
6,308 KB
testcase_74 AC 240 ms
6,228 KB
testcase_75 AC 248 ms
6,184 KB
testcase_76 AC 249 ms
6,256 KB
testcase_77 AC 237 ms
6,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

class modint {
    static u32 &mod() { static u32 mod_ = 0; return mod_; }
public:
    u32 val;
    modint(const u32 x = 0) : val(x % M()) {}
    u32 &value() noexcept { return val; }
    const u32 &value() const noexcept { return val; }
    modint operator+(const modint b) const { return modint(*this) += b; }
    modint operator-(const modint b) const { return modint(*this) -= b; }
    modint operator*(const modint b) const { return modint(*this) *= b; }
    modint operator/(const modint b) const { return modint(*this) /= b; }
    modint &operator+=(const modint b) { val += b.val; if (val >= M()) val -= M(); return *this; }
    modint &operator-=(const modint b) { if (val < b.val) val += M(); val -= b.val; return *this; }
    modint &operator*=(const modint b) { val = (u64)val * b.val % M(); return *this; }
    modint pow(ll n) const { modint x = *this, r = 1; while(n){ if(n&1) r *= x; x *= x; n >>= 1; } return r; }
    modint &operator/=(modint b) { return *this *= b.pow(M()-2); }
    static void set_mod(const u32 x) { mod() = x; }
    static int M() { return mod(); }
};
using mint = modint;

int main() {
    int n, k, m;
    cin >> n >> k >> m;
    vector<int> a(n), b(n), c(n), d(n);
    for (auto &&i : a) scanf("%d", &i);
    for (auto &&i : b) scanf("%d", &i);
    for (auto &&i : c) scanf("%d", &i);
    for (auto &&i : d) scanf("%d", &i);
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    mint::set_mod(m);
    mint ans = 0;
    for (int i = 0; i < n; ++i) {
        int l = min({a[i], b[i], c[i], d[i]}), r = max({a[i], b[i], c[i], d[i]});
        ans += mint(r-l).pow(k);
    }
    cout << ans.val << "\n";
    return 0;
}
0