結果
| 問題 |
No.1279 Array Battle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-06 23:29:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 1,155 bytes |
| コンパイル時間 | 3,354 ms |
| コンパイル使用メモリ | 209,456 KB |
| 最終ジャッジ日時 | 2025-01-15 21:16:56 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
// 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;
}