結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2018-01-20 02:25:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 926 ms |
コンパイル使用メモリ | 68,368 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 12:59:08 |
合計ジャッジ時間 | 1,833 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 1 |
ソースコード
#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; }