結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2019-08-26 21:27:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 686 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 81,592 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 05:26:41 |
合計ジャッジ時間 | 1,940 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<iostream>#include<algorithm>#include <vector>#include<cmath>#include<iomanip>using namespace std;typedef long long int lont;int main() {int N;cin >> N;vector<int>veca(N);vector<int>vecb(N);int pnt = 0;for (int ia = 0; ia < N; ia++) {cin >> veca.at(ia);}for (int ib = 0; ib < N; ib++) {cin >> vecb.at(ib);}vector<int>vecc(100);for (int ic = 0; ic < N; ic++) {if (vecb.at(ic) != 0) {vecc.at(vecb.at(ic) - 1) += veca.at(ic);}else {pnt += veca.at(ic);}}int cnt = 0;for (int id = 0; id < 100; id++) {if (vecc.at(id) > pnt) {cnt++;}}if (cnt) {cout << "NO" << endl;}else {cout << "YES" << endl;}}