結果

問題 No.216 FAC
ユーザー kuisibakuisiba
提出日時 2016-04-09 19:17:05
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 850 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 64,436 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 00:57:58
合計ジャッジ時間 1,465 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    vector<int> b;
    vector<int> othersScore(101, 0);
    for (int i = 0; i < n; ++i) {
        int temp;
        cin >> temp;
        b.push_back(temp);
        if (temp != 0) {
            othersScore.at(temp) += a.at(i);
        }
    }
    int myScore = 0;
    for (int i = 0; i < n; ++i) {
        if (b.at(i) == 0) {
            myScore += a.at(i);
        }
    }
    if (myScore >= *max_element(othersScore.begin(), othersScore.end())) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
0