結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-11-08 23:45:53 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 28 ms / 2,000 ms | 
| コード長 | 661 bytes | 
| コンパイル時間 | 3,100 ms | 
| コンパイル使用メモリ | 204,208 KB | 
| 最終ジャッジ日時 | 2025-01-15 21:46:23 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
int main() {
    int n; cin >> n;
    V<ll> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    V<int> nums(n);
    iota(ALL(nums), 0);
    map<ll, ll> mp;
    ll ma = 0;
    do {
        ll sum = 0;
        int i = 0;
        for(auto j : nums){
            if(b[i] < a[j]) sum += a[j] - b[i];
            i++;
        }
        ma = max(sum, ma);
        mp[sum]++;
    } while(next_permutation(nums.begin(), nums.end()));
    cout << mp[ma] << endl;
    return 0;
}
            
            
            
        