結果
| 問題 | No.216 FAC |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2020-03-18 15:11:41 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 189µs | |
| コード長 | 453 bytes |
| 記録 | |
| コンパイル時間 | 862 ms |
| コンパイル使用メモリ | 182,516 KB |
| 実行使用メモリ | 9,872 KB |
| 最終ジャッジ日時 | 2026-10-03 04:35:35 |
| 合計ジャッジ時間 | 2,694 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> a( N );
vector<int> b( N );
for( int i = 0; i < N; i++ ) {
cin >> a[i];
}
for( int i = 0; i < N; i++ ) {
cin >> b[i];
}
vector<int> c( 100 );
int r = 0;
for( int i = 0; i < N; i++ ) {
if( b[i] == 0 ) r += a[i];
else c[b[i] - 1] += a[i];
}
string ans = "NO";
if( *max_element( c.begin(), c.end() ) <= r ) ans = "YES";
cout << ans << endl;
}
forest3