結果

問題 No.216 FAC
ユーザー furafy
提出日時 2015-05-27 04:06:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 59,096 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 10:34:16
合計ジャッジ時間 1,293 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

bool judge(vector<int> &h, int n) {
  for (int i = 1; i < n; i++) {
    if (h[0] < h[i])
      return false;
  }
  return true;
}

int main(void) {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N;
  int cnt = 0;
  cin >> N;
  vector<int> point(N);
  vector<int> hold(N);
  while (cnt < 2) {
    for (int i = 0; i < N; i++) {
      int n;
      cin >> n;
      if (cnt == 0) {
        point[i] = n;
        hold[i] = 0;
      } else {
        hold[n] += point[i];
      }
    }
    cnt++;
  }
  cout << ((judge(hold, N)) ? "YES" : "NO") << endl;
}
0