結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sorag
                         | 
                    
| 提出日時 | 2022-08-12 23:35:06 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 533 bytes | 
| コンパイル時間 | 816 ms | 
| コンパイル使用メモリ | 80,300 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-23 04:15:17 | 
| 合計ジャッジ時間 | 2,052 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 5 RE * 2 | 
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int n,ma=0,k=0;
    cin>>n;
    vector<int> a(n),b(n),c(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
        c[b[i]]+=a[i];
        ma=max(ma,c[i]);
        if(b[i]==0) k+=a[i];
    }
    if(k>=ma) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}
  
    
            
            
            
        
            
sorag