結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2018-02-12 22:47:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 514 bytes |
コンパイル時間 | 1,514 ms |
コンパイル使用メモリ | 169,768 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 00:58:11 |
合計ジャッジ時間 | 2,875 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 2 RE * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; vector<int> score(N, 0), a(N); int sum = 0; for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; i++) { int b; cin >> b; if (b == 0) sum += a[i]; else score[b - 1] += a[i]; } int mx = *max_element(begin(score), end(score)); if (mx <= sum) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }