結果
問題 | No.1279 Array Battle |
ユーザー | marroncastle |
提出日時 | 2020-11-06 23:29:54 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 1,155 bytes |
コンパイル時間 | 2,779 ms |
コンパイル使用メモリ | 214,768 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-29 19:41:17 |
合計ジャッジ時間 | 3,061 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,376 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 5 ms
4,376 KB |
testcase_14 | AC | 3 ms
4,376 KB |
testcase_15 | AC | 10 ms
4,376 KB |
testcase_16 | AC | 12 ms
4,376 KB |
testcase_17 | AC | 21 ms
4,380 KB |
testcase_18 | AC | 33 ms
4,380 KB |
testcase_19 | AC | 18 ms
4,380 KB |
ソースコード
// g++ A.cpp -std=c++14 -I . && ./a.out #include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // using mint = modint1000000007; // using mint = modint998244353; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, a, b) for (int i = a; i < (int)(b); i++) #define rrep(i, a, b) for (int i = a; i > (int)(b); i--) #define all(v) v.begin(), v.end() using ll = long long; const ll INF = 1e18; // 変数定義 ll N, M, Q, a, b, c, d, x, y, t, T, total, score, ans; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N; vector<pair<int, ll>> A(N); vector<ll> B(N); rep(i, N) { cin >> a; A[i] = make_pair(i, a); } rep(i, N) { cin >> B[i]; } sort(all(A)); map<ll, ll> scores; ll max_score = 0; do { score = 0; rep(i, N) { score += max(0LL, A[i].second - B[i]); } // cout << score << '\n'; if (scores.count(score)) scores[score]++; else scores[score] = 1; if (score > max_score) max_score = score; } while (next_permutation(all(A))); cout << scores[max_score] << '\n'; return 0; }