結果
問題 | No.1359 [Zelkova 3rd Tune] 四人セゾン |
ユーザー | BSer |
提出日時 | 2021-01-22 21:39:34 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,270 ms / 2,000 ms |
コード長 | 2,588 bytes |
コンパイル時間 | 1,705 ms |
コンパイル使用メモリ | 176,092 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-07-04 17:12:05 |
合計ジャッジ時間 | 70,390 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 3 ms
5,376 KB |
testcase_02 | AC | 3 ms
5,376 KB |
testcase_03 | AC | 596 ms
7,296 KB |
testcase_04 | AC | 625 ms
7,168 KB |
testcase_05 | AC | 573 ms
7,296 KB |
testcase_06 | AC | 645 ms
7,168 KB |
testcase_07 | AC | 835 ms
8,960 KB |
testcase_08 | AC | 840 ms
8,832 KB |
testcase_09 | AC | 235 ms
5,376 KB |
testcase_10 | AC | 228 ms
5,376 KB |
testcase_11 | AC | 1,052 ms
10,368 KB |
testcase_12 | AC | 1,004 ms
10,240 KB |
testcase_13 | AC | 686 ms
7,808 KB |
testcase_14 | AC | 695 ms
7,936 KB |
testcase_15 | AC | 603 ms
7,168 KB |
testcase_16 | AC | 606 ms
7,168 KB |
testcase_17 | AC | 1,153 ms
10,624 KB |
testcase_18 | AC | 1,169 ms
10,624 KB |
testcase_19 | AC | 1,012 ms
9,600 KB |
testcase_20 | AC | 978 ms
9,728 KB |
testcase_21 | AC | 1,142 ms
10,112 KB |
testcase_22 | AC | 1,070 ms
10,112 KB |
testcase_23 | AC | 768 ms
8,064 KB |
testcase_24 | AC | 713 ms
8,192 KB |
testcase_25 | AC | 112 ms
5,376 KB |
testcase_26 | AC | 116 ms
5,376 KB |
testcase_27 | AC | 390 ms
5,760 KB |
testcase_28 | AC | 372 ms
5,632 KB |
testcase_29 | AC | 480 ms
6,400 KB |
testcase_30 | AC | 483 ms
6,400 KB |
testcase_31 | AC | 676 ms
7,296 KB |
testcase_32 | AC | 645 ms
7,424 KB |
testcase_33 | AC | 497 ms
6,400 KB |
testcase_34 | AC | 500 ms
6,400 KB |
testcase_35 | AC | 614 ms
7,168 KB |
testcase_36 | AC | 601 ms
7,168 KB |
testcase_37 | AC | 118 ms
5,376 KB |
testcase_38 | AC | 121 ms
5,376 KB |
testcase_39 | AC | 98 ms
5,376 KB |
testcase_40 | AC | 100 ms
5,376 KB |
testcase_41 | AC | 270 ms
5,376 KB |
testcase_42 | AC | 253 ms
5,376 KB |
testcase_43 | AC | 211 ms
5,376 KB |
testcase_44 | AC | 1,153 ms
10,752 KB |
testcase_45 | AC | 467 ms
6,272 KB |
testcase_46 | AC | 161 ms
5,376 KB |
testcase_47 | AC | 845 ms
8,320 KB |
testcase_48 | AC | 737 ms
8,448 KB |
testcase_49 | AC | 763 ms
8,448 KB |
testcase_50 | AC | 583 ms
7,168 KB |
testcase_51 | AC | 30 ms
5,376 KB |
testcase_52 | AC | 1,062 ms
9,856 KB |
testcase_53 | AC | 1,270 ms
11,008 KB |
testcase_54 | AC | 1,235 ms
11,136 KB |
testcase_55 | AC | 1,186 ms
11,008 KB |
testcase_56 | AC | 1,177 ms
11,136 KB |
testcase_57 | AC | 1,170 ms
11,008 KB |
testcase_58 | AC | 1,195 ms
11,008 KB |
testcase_59 | AC | 1,154 ms
11,136 KB |
testcase_60 | AC | 1,120 ms
11,008 KB |
testcase_61 | AC | 1,118 ms
11,008 KB |
testcase_62 | AC | 1,258 ms
11,008 KB |
testcase_63 | AC | 1,183 ms
11,136 KB |
testcase_64 | AC | 1,179 ms
11,008 KB |
testcase_65 | AC | 1,190 ms
11,136 KB |
testcase_66 | AC | 1,149 ms
11,008 KB |
testcase_67 | AC | 1,258 ms
11,008 KB |
testcase_68 | AC | 1,178 ms
11,008 KB |
testcase_69 | AC | 1,132 ms
11,136 KB |
testcase_70 | AC | 1,114 ms
11,008 KB |
testcase_71 | AC | 1,096 ms
11,136 KB |
testcase_72 | AC | 1,239 ms
11,136 KB |
testcase_73 | AC | 1,144 ms
11,008 KB |
testcase_74 | AC | 1,169 ms
11,008 KB |
testcase_75 | AC | 1,146 ms
11,136 KB |
testcase_76 | AC | 1,119 ms
11,136 KB |
testcase_77 | AC | 1,144 ms
11,136 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; struct Edge { ll to; ll cost; }; using Graph = vector<vector<Edge>>; using P = pair<ll, ll>; #define mp make_pair #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ALL(v) (v).begin(), v.end() ll MOD = 1000000007; const ll nmax = 8; const ll INF = 1e10; const int MAX = 510000; bool graph[nmax][nmax]; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } ll COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF)); void warshall_floyd(ll n) { for (size_t i = 0; i < n; i++) { for (size_t j = 0; j < n; j++) { for (size_t k = 0; k < n; k++) { dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]); } } } } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; } ll mulMod(ll a, ll b) { return (((a % MOD) * (b % MOD)) % MOD); } ll powMod(ll a, ll p) { if (p == 0) { return 1; } else if (p % 2 == 0) { ll half = powMod(a, p / 2); return mulMod(half, half); } else { return mulMod(powMod(a, p - 1), a); } } ll ceil(ll a, ll b) { return (a + b - 1) / b; } int main() { ll N, K; cin >> N >> K >> MOD; vector<ll> a(N), b(N), c(N), d(N); for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; i++) { cin >> b[i]; } for (int i = 0; i < N; i++) { cin >> c[i]; } for (int i = 0; i < N; i++) { cin >> d[i]; } SORT(a); SORT(b); SORT(c); SORT(d); vector<ll> num(N); for (int i = 0; i < N; i++) { num[i] = max({a[i], b[i], c[i], d[i]}) - min({a[i], b[i], c[i], d[i]}); } ll ans = 0; for (int i = 0; i < N; i++) { cerr << num[i] << " "; ans += powMod(num[i], K); ans %= MOD; } cerr << endl; cout << ans << endl; return 0; }