結果

問題 No.216 FAC
ユーザー RCCW
提出日時 2017-02-06 18:47:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 494 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 158,044 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 08:16:54
合計ジャッジ時間 2,029 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n;
  cin>>n;
  int a[n],b[n];
  int c[101]={0};
  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) {
  	c[b[i]]+=a[i];
  }
  for (int i = 1; i <= 100; ++i) {
    	if(c[0]<c[i]){
    		cout<<"NO"<<endl;
    		return 0;
    	}
   }
  cout<<"YES"<<endl;
}


/*
2 1
3 7
4 11
5 71
6 111
7 711
8 1111
9 71111
10 11111
*/
0