結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2015-08-23 20:44:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 524 ms |
コンパイル使用メモリ | 63,492 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 00:41:45 |
合計ジャッジ時間 | 1,297 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<numeric>static const int PEOPLE = 100;int main() {int problem_num;std::cin >> problem_num;std::vector<int> score, solved(PEOPLE + 1, 0);for (int i = 0; i < problem_num; i++) {int num;std::cin >> num;score.push_back(num);}for (int i = 0; i < problem_num; i++) {int num;std::cin >> num;solved[num] += score[i];if (num != 0) score[i] = 0;}solved[0] = 0; //解かれてない問題は集計しないint top_score = *std::max_element(solved.begin(), solved.end());int player_score = std::accumulate(score.begin(), score.end(), 0);std::cout << (top_score <= player_score ? "YES" : "NO") << std::endl;return 0;}