結果
| 問題 | No.1279 Array Battle | 
| コンテスト | |
| ユーザー |  norioc | 
| 提出日時 | 2020-11-08 16:56:30 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 701 bytes | 
| コンパイル時間 | 3,925 ms | 
| コンパイル使用メモリ | 78,000 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-22 15:14:52 | 
| 合計ジャッジ時間 | 1,639 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 20 | 
ソースコード
#include <iostream>
#include <numeric>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> a(N), b(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < N; i++) cin >> b[i];
    sort(a.begin(), a.end());
    int ans = 0;
    int maxScore = -1;
    do {
        int s = 0;
        for (int i = 0; i < N; i++) {
            s += max(0, a[i] - b[i]);
        }
        if (s > maxScore) {
            maxScore = s;
            ans = 0;
            cout << "max " << maxScore << endl;
        }
        if (s == maxScore) ans++;
    } while (next_permutation(a.begin(), a.end()));
    cout << ans << endl;
}
            
            
            
        