結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  ate | 
| 提出日時 | 2020-12-10 08:46:34 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 484 bytes | 
| コンパイル時間 | 2,478 ms | 
| コンパイル使用メモリ | 197,656 KB | 
| 最終ジャッジ日時 | 2025-01-16 21:15:40 | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 4 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n),b(n);
    for(auto&ai:a)cin>>ai;
    for(auto&bi:b)cin>>bi;
    int pmax=-1,ans=0;
    sort(begin(a),end(a));
    do{
        int p=0;
        for(int i=0;i<n;++i)if(a[i]>b[i]){
            p+=a[i]-b[i];
        }
        if(p>pmax){
            pmax=p;
            ans=1;
        }
        else if(p==pmax)ans++;
    }while(next_permutation(begin(a),end(a)));
    cout<<ans<<endl;
}
            
            
            
        