結果

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

ソースコード

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]] += data1[i];
	}
	for(int i = 0; i < n; i++){
		if(count < score[i]){
			cout << "NO" << endl;
			exit(1);
		}
	}
	cout << "YES" << endl;
	return 0;
}
0