結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hanorver
                         | 
                    
| 提出日時 | 2015-08-23 20:40:59 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 725 bytes | 
| コンパイル時間 | 546 ms | 
| コンパイル使用メモリ | 63,452 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-18 13:04:15 | 
| 合計ジャッジ時間 | 1,581 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 23 WA * 1 | 
ソースコード
#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, 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;
}
            
            
            
        
            
hanorver