結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2018-01-20 02:26:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 68,336 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 12:59:12 |
合計ジャッジ時間 | 2,207 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<iostream>#include<string>#include<algorithm>#include<cmath>#include<math.h>#include<iomanip>#include<stdio.h>#include<cstring>using namespace std;int main(){int n, a[100], b[100], member[101]={0}, k=0;cin >> n;for(int i=0; i<n; i++){cin >> a[i];}for(int i=0; i<n; i++){cin >> b[i];}for(int i=0; i<n; i++){if(b[i]==0){k+=a[i];} else {member[b[i]]+=a[i];}}for(int i=0; i<=100; i++){if(member[i]>k){cout << "NO" << endl;return 0;}}cout << "YES" << endl;return 0;}