結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  srjywrdnprkt | 
| 提出日時 | 2024-04-04 12:10:33 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 25 ms / 2,000 ms | 
| コード長 | 579 bytes | 
| コンパイル時間 | 2,420 ms | 
| コンパイル使用メモリ | 202,672 KB | 
| 最終ジャッジ日時 | 2025-02-20 20:01:40 | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int N, sm;
    map<int, int> mp;
    cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int i=0; i<N; i++) cin >> a[i];
    for (int i=0; i<N; i++) cin >> b[i];
    iota(c.begin(), c.end(), 0);
    do{
        sm = 0;
        for (int i=0; i<N; i++){
            sm += max(0, a[c[i]]-b[i]);
        }
        mp[sm]++;
    } while(next_permutation(c.begin(), c.end()));
    cout << mp.rbegin()->second << endl;
    return 0;
}
            
            
            
        