結果

問題 No.216 FAC
ユーザー Mizuno
提出日時 2024-10-23 23:42:49
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 411 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 93,028 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-23 23:42:52
合計ジャッジ時間 2,427 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>

using namespace std;

int main() {
	int n;
	cin >> n;
	map<int,int> m;
	int a[n],b[n];
	for(int i = 0; i < n; i++)cin >> a[i];
	for(int i = 0; i < n; i++){
		cin >> b[i];
		m[b[i]] = 0;
	}
	for(int i = 0; i < n; i++) m[b[i]] += a[i];
	
	int max = 0;
	for(int i = 0; i < n; i++) if(max < m[b[i]]) max = m[b[i]];
	
	
	if(max == m[0])cout << "YES";
	else cout << "NO";
	
	
	
	
}
0