結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-06 16:11:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 436 bytes |
| コンパイル時間 | 2,274 ms |
| コンパイル使用メモリ | 196,164 KB |
| 最終ジャッジ日時 | 2025-01-14 07:51:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 3 RE * 2 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;
string solve() {
int N, x, c = 0;
cin >> N;
vector<int> a(N), b(N);
rep(i, 0, N) cin >> a[i];
rep(i, 0, N) {
cin >> x;
b[x] += a[i];
}
rep(i, 0, N) c = max(c, b[i]);
if (c <= b[0]) return "YES";
return "NO";
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << solve() << endl;
getchar();
}