結果

問題 No.216 FAC
ユーザー zaichu
提出日時 2015-12-18 00:46:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 482 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 59,916 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-16 08:15:14
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 2 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> data1(n);
	vector<int> data2(n);
	vector<int> score(n,0);
	for(auto &a:data1) cin >> a;
	for(auto &b:data2) cin >> b;
	int count = 0;
	for(int i = 0; i < n; i++){
		if(data2[i] == 0) count += data1[i];
		else score[data2[i]-1] += data1[i];
	}
	for(int i = 0; i < n; i++){
		if(count < score[i]){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}
0