結果

問題 No.216 FAC
ユーザー test
提出日時 2020-09-06 16:18:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 440 bytes
コンパイル時間 2,774 ms
コンパイル使用メモリ 194,716 KB
最終ジャッジ日時 2025-01-14 07:51:40
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

string solve() {
  int N, x, c = 0;
  cin >> N;
  vector<int> a(N), b(101);
  rep(i, 0, N) cin >> a[i];
  rep(i, 0, N) {
    cin >> x;
    b[x] += a[i];
  }
  rep(i, 0, 101) c = max(c, b[i]);
  if (c <= b[0]) return "YES";
  return "NO";
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << solve() << endl;
  getchar();
}
0