結果
問題 | No.1359 [Zelkova 3rd Tune] 四人セゾン |
ユーザー | betit0919 |
提出日時 | 2021-01-22 21:52:43 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 272 ms / 2,000 ms |
コード長 | 3,318 bytes |
コンパイル時間 | 1,505 ms |
コンパイル使用メモリ | 131,124 KB |
実行使用メモリ | 6,428 KB |
最終ジャッジ日時 | 2023-08-27 18:41:57 |
合計ジャッジ時間 | 20,229 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 136 ms
4,708 KB |
testcase_04 | AC | 135 ms
4,516 KB |
testcase_05 | AC | 123 ms
4,572 KB |
testcase_06 | AC | 123 ms
4,588 KB |
testcase_07 | AC | 183 ms
5,352 KB |
testcase_08 | AC | 185 ms
5,460 KB |
testcase_09 | AC | 52 ms
4,380 KB |
testcase_10 | AC | 52 ms
4,376 KB |
testcase_11 | AC | 237 ms
5,904 KB |
testcase_12 | AC | 238 ms
5,840 KB |
testcase_13 | AC | 152 ms
4,936 KB |
testcase_14 | AC | 152 ms
4,900 KB |
testcase_15 | AC | 135 ms
4,512 KB |
testcase_16 | AC | 135 ms
4,576 KB |
testcase_17 | AC | 253 ms
6,008 KB |
testcase_18 | AC | 254 ms
5,908 KB |
testcase_19 | AC | 220 ms
5,636 KB |
testcase_20 | AC | 220 ms
5,732 KB |
testcase_21 | AC | 237 ms
5,648 KB |
testcase_22 | AC | 237 ms
5,644 KB |
testcase_23 | AC | 160 ms
5,212 KB |
testcase_24 | AC | 160 ms
4,848 KB |
testcase_25 | AC | 26 ms
4,380 KB |
testcase_26 | AC | 26 ms
4,380 KB |
testcase_27 | AC | 84 ms
4,376 KB |
testcase_28 | AC | 84 ms
4,376 KB |
testcase_29 | AC | 103 ms
4,376 KB |
testcase_30 | AC | 106 ms
4,384 KB |
testcase_31 | AC | 137 ms
4,672 KB |
testcase_32 | AC | 137 ms
4,636 KB |
testcase_33 | AC | 102 ms
4,384 KB |
testcase_34 | AC | 101 ms
4,396 KB |
testcase_35 | AC | 134 ms
4,640 KB |
testcase_36 | AC | 134 ms
4,668 KB |
testcase_37 | AC | 27 ms
4,380 KB |
testcase_38 | AC | 28 ms
4,380 KB |
testcase_39 | AC | 23 ms
4,380 KB |
testcase_40 | AC | 22 ms
4,376 KB |
testcase_41 | AC | 48 ms
4,376 KB |
testcase_42 | AC | 48 ms
4,376 KB |
testcase_43 | AC | 39 ms
4,376 KB |
testcase_44 | AC | 251 ms
5,876 KB |
testcase_45 | AC | 106 ms
4,540 KB |
testcase_46 | AC | 36 ms
4,380 KB |
testcase_47 | AC | 180 ms
5,044 KB |
testcase_48 | AC | 168 ms
5,112 KB |
testcase_49 | AC | 169 ms
5,024 KB |
testcase_50 | AC | 129 ms
4,556 KB |
testcase_51 | AC | 8 ms
4,380 KB |
testcase_52 | AC | 224 ms
5,616 KB |
testcase_53 | AC | 254 ms
6,424 KB |
testcase_54 | AC | 267 ms
6,336 KB |
testcase_55 | AC | 263 ms
6,100 KB |
testcase_56 | AC | 266 ms
6,164 KB |
testcase_57 | AC | 269 ms
6,144 KB |
testcase_58 | AC | 266 ms
6,172 KB |
testcase_59 | AC | 263 ms
6,240 KB |
testcase_60 | AC | 259 ms
6,104 KB |
testcase_61 | AC | 247 ms
6,244 KB |
testcase_62 | AC | 264 ms
6,164 KB |
testcase_63 | AC | 265 ms
6,228 KB |
testcase_64 | AC | 268 ms
6,280 KB |
testcase_65 | AC | 264 ms
6,428 KB |
testcase_66 | AC | 263 ms
6,268 KB |
testcase_67 | AC | 272 ms
6,172 KB |
testcase_68 | AC | 259 ms
6,168 KB |
testcase_69 | AC | 244 ms
6,164 KB |
testcase_70 | AC | 245 ms
6,420 KB |
testcase_71 | AC | 237 ms
6,224 KB |
testcase_72 | AC | 269 ms
6,272 KB |
testcase_73 | AC | 261 ms
6,084 KB |
testcase_74 | AC | 257 ms
6,220 KB |
testcase_75 | AC | 260 ms
6,256 KB |
testcase_76 | AC | 256 ms
6,100 KB |
testcase_77 | AC | 258 ms
6,228 KB |
ソースコード
#include <algorithm> #include <cassert> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; 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; } const int INF = (1 << 30) - 1; const ll INFLL = (1LL << 61) - 1; const int MOD = 1000000007; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() #define FOR(i, a, b) for(int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) template <int &Modulo> struct Mint { ll val; constexpr Mint(ll v = 0) noexcept : val(v % Modulo) { if(val < 0) val += Modulo; } constexpr Mint &operator+=(const Mint &r) noexcept { val += r.val; if(val >= Modulo) val -= Modulo; return *this; } constexpr Mint &operator-=(const Mint &r) noexcept { val -= r.val; if(val < 0) val += Modulo; return *this; } constexpr Mint &operator*=(const Mint &r) noexcept { val = val * r.val % Modulo; return *this; } constexpr Mint &operator/=(const Mint &r) noexcept { ll a = r.val, b = Modulo, u = 1, v = 0; while(b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % Modulo; if(val < 0) val += Modulo; return *this; } constexpr Mint operator+(const Mint &r) const noexcept { return Mint(*this) += r; } constexpr Mint operator-(const Mint &r) const noexcept { return Mint(*this) -= r; } constexpr Mint operator*(const Mint &r) const noexcept { return Mint(*this) *= r; } constexpr Mint operator/(const Mint &r) const noexcept { return Mint(*this) /= r; } constexpr int getmod() { return Modulo; } constexpr Mint operator-() const noexcept { return val ? Modulo - val : 0; } constexpr bool operator==(const Mint &r) const noexcept { return val == r.val; } constexpr bool operator!=(const Mint &r) const noexcept { return val != r.val; } constexpr bool operator<(const Mint &r) const noexcept { return val < r.val; } friend ostream &operator<<(ostream &os, const Mint<Modulo> &x) noexcept { return os << x.val; } friend istream &operator>>(istream &is, Mint<Modulo> &x) noexcept { ll tmp; is >> tmp; x = Mint(tmp); return is; } constexpr Mint pow(ll n) noexcept { Mint res{1}, tmp{val}; while(n > 0) { if(n & 1) res *= tmp; tmp *= tmp; n >>= 1; } return res; } }; int RMOD; using mint = Mint<RMOD>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, K; cin >> N >> K >> RMOD; vector<int> P(N), E(N), A(N), H(N); REP(i, N) cin >> P[i]; REP(i, N) cin >> E[i]; REP(i, N) cin >> A[i]; REP(i, N) cin >> H[i]; sort(ALL(P)); sort(ALL(E)); sort(ALL(A)); sort(ALL(H)); mint ans = 0; REP(i, N) { ans += mint(max({P[i], E[i], A[i], H[i]}) - min({P[i], E[i], A[i], H[i]})) .pow(K); } cout << ans << endl; }