結果

問題 No.216 FAC
ユーザー sggkshio
提出日時 2016-10-27 07:42:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 542 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 79,440 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 04:00:38
合計ジャッジ時間 1,812 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;




int main() {

	int n;
	cin>>n;
	int t[105]={};
	int x[105]={};
	for(int i=0;i<n;i++)
		cin>>t[i];
	int m=0;
	for(int i=0;i<n;i++){
		int y;cin>>y;
		x[y]+=t[i];
		m=max(m,x[y]);
	}
	
	if(x[0]>=m)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;


	return 0;
}


	
0