結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2015-10-25 20:51:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 1,501 ms |
コンパイル使用メモリ | 159,600 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 00:43:10 |
合計ジャッジ時間 | 2,229 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() typedef vector<int>vi; int main(){ int n; cin>>n; vi a(n); vi cnt(100); rep(i,n)cin>>a[i]; int sum=0; rep(i,n){ int b; cin>>b; b--; if(~b)cnt[b]+=a[i]; else sum+=a[i]; } if(sum>=*max_element(all(cnt)))cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }