結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2018-02-28 10:34:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,192 bytes |
コンパイル時間 | 822 ms |
コンパイル使用メモリ | 73,644 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 15:40:36 |
合計ジャッジ時間 | 1,346 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
// No.216 FAC// https://yukicoder.me/problems/no/216//#include <iostream>#include <vector>#include <string>#include <algorithm>using namespace std;string solve(int N);int main() {int N;cin >> N;string ans = solve(N);cout << ans << endl;}string solve(int N) {// 問題ごとのスコアvector<int> points(N);for (auto i = 0; i < N; i++)cin >> points[i];// 問題ごとの1st回答者情報vector<int> results(N);for (auto i = 0; i < N; i++)cin >> results[i];// 参加者のスコアを集計vector<int> scores(101, 0); // 参加者のスコアを0点で初期化(0番目がK君のスコア用)for (auto i = 0; i < N; i++) {if (results[i]) { // 回答済の場合、1st回答者にポイントを加算scores[results[i]] += points[i];} else { // そうでなければ、K君が解いたことにするscores[0] += points[i];}}int others_max = *max_element(scores.begin()+1, scores.end()); // K君以外の最高スコアif (scores[0] >= others_max)return "YES";elsereturn "NO";}