結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2021-11-25 00:20:19 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 552 bytes | 
| コンパイル時間 | 696 ms | 
| コンパイル使用メモリ | 75,520 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-27 10:00:38 | 
| 合計ジャッジ時間 | 1,534 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 20 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> A(n),B(n);
    for(int i = 0; n > i; i++){
        cin>>A[i];
    }
    for(int i = 0; n > i; i++){
        cin>>B[i];
    }
    sort(A.begin(),A.end());
    int ans = 0;
    do{
        int tmp = 0;
        for(int i = 0; n > i; i++){
            if(A[i] > B[i]){
                tmp += A[i]-B[i];
            }
        }
        ans = max(ans,tmp);
    }while(next_permutation(A.begin(),A.end()));
    cout << ans << endl;
}
            
            
            
        