結果

問題 No.1279 Array Battle
ユーザー 👑 CleyL
提出日時 2021-11-25 00:21:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 76,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 10:01:26
合計ジャッジ時間 1,451 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    int t = 0;
    do{
        int tmp = 0;
        for(int i = 0; n > i; i++){
            if(A[i] > B[i]){
                tmp += A[i]-B[i];
            }
        }
        if(tmp > ans){
            ans = tmp;
            t = 1;
        }else if(tmp == ans){
            t++;
        }
        
    }while(next_permutation(A.begin(),A.end()));
    cout << t << endl;
}
0