結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2018-09-06 01:58:52 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 564 ms |
コンパイル使用メモリ | 66,156 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 08:57:46 |
合計ジャッジ時間 | 1,392 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
//inlclude前用define#define _USE_MATH_DEFINES//include#include<iostream>#include<string>#include<algorithm>#include<vector>#include<cmath>using namespace std;//typedeftypedef vector<int> VI;typedef vector<string> VS;typedef vector<char> VC;int main() {int n;cin >> n;VI a(n), b(n);VI s(101);for (int i = 0; i < n; i++) cin >> a[i];for (int i = 0; i < n; i++) cin >> b[i];int sum = 0;for (int i = 0; i < n; i++) {if (b[i] == 0) sum += a[i];else s[b[i]] += a[i];}bool flag = true;for (int i = 0; i < 101; i++) {if (s[i] > sum) flag = false;}if (flag) cout << "YES" << endl;else cout << "NO" << endl;return 0;}