結果

問題 No.216 FAC
ユーザー hadrori
提出日時 2015-07-25 16:54:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 1,618 ms
コンパイル使用メモリ 157,276 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 00:40:00
合計ジャッジ時間 2,364 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repi(i,0,n)

int n, a[128], b[128], c[128];

int solve() {
    rep(i,n) c[b[i]] += a[i];
    return c[0] == *max_element(c,c+101);
}

void input() {
    cin >> n;
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout << fixed << setprecision(12);
    input();
    puts(solve()? "YES": "NO");
    return 0;
}
0