結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  ate | 
| 提出日時 | 2020-12-10 08:50:10 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 11 ms / 2,000 ms | 
| コード長 | 548 bytes | 
| コンパイル時間 | 2,470 ms | 
| コンパイル使用メモリ | 199,176 KB | 
| 最終ジャッジ日時 | 2025-01-16 21:16:08 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<double> a(n);
    vector<int>b(n);
    for(auto&ai:a)cin>>ai;
    for(auto&bi:b)cin>>bi;
    for(double i=0;i<n;i+=1)a[int(i)]+=0.1*i;
    int pmax=0,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;
}
            
            
            
        