結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2021-03-18 20:14:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 2,994 ms |
コンパイル使用メモリ | 198,464 KB |
最終ジャッジ日時 | 2025-01-19 18:06:32 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define rep(i,n) for(int i=0;i<n;i++)typedef pair<int,int>P;int main(){int n;cin>>n;int p[n];int c[n];map<int,int>mp;rep(i,n) cin>>p[i];rep(i,n){cin>>c[i];mp[c[i]]+=p[i];}int po=0;rep(i,n){if(c[i]==0) po+=p[i];}for(auto e:mp){if(e.second>po){cout<<"NO"<<endl;return 0;}}cout<<"YES"<<endl;return 0;}