結果
| 問題 | No.216 FAC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-10-26 00:17:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 670 bytes |
| 記録 | |
| コンパイル時間 | 569 ms |
| コンパイル使用メモリ | 61,124 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 00:43:20 |
| 合計ジャッジ時間 | 1,473 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <stack>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define SQR(X) ((X)*(X))
typedef long long ll;
typedef unsigned long long ull;
typedef long double lb;
/* ここからが本編 */
int main(void)
{
int i,j;
int n;
int a[100];
int c[101] = {0};
int b;
int max = 0;
int sum = 0;
cin >> n;
rep(i,n) {
cin >> a[i];
}
rep(i,n) {
cin >> b;
if(b == 0) sum += a[i];
else c[b] += a[i];
}
sort(c,c+101);
if(c[100] > sum) cout << "NO\n";
else cout << "YES\n";
return 0;
}