結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-11-06 22:05:13 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 23 ms / 2,000 ms | 
| コード長 | 627 bytes | 
| コンパイル時間 | 1,937 ms | 
| コンパイル使用メモリ | 175,480 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-22 12:51:03 | 
| 合計ジャッジ時間 | 2,892 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int N; cin >> N;
    vector<int> a(N),b(N);
    rep(i,N) cin >> a[i];
    rep(i,N) cin >> b[i];
    map<ll,ll> mp;
    vector<int> c(N);
    iota(c.begin(), c.end(), 0);
    do{
        ll now = 0;
        rep(i,N){
            now = now + max(a[c[i]] - b[i], 0);
        }
        mp[now]++;
    }while(next_permutation(c.begin(), c.end()));
    ll ans = 0;
    for(auto u : mp){
        ans = max(ans, u.first);
    }
    cout << mp[ans] << endl;
}
            
            
            
        