結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             xuelei
                         | 
                    
| 提出日時 | 2018-07-18 20:07:54 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 293 bytes | 
| コンパイル時間 | 764 ms | 
| コンパイル使用メモリ | 66,548 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-16 03:30:52 | 
| 合計ジャッジ時間 | 1,699 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 22 WA * 2 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:6:12: warning: 'n' is used uninitialized [-Wuninitialized]
    6 |   int n,a[n],b[n],s[101]={};
      |            ^
main.cpp:6:7: note: 'n' declared here
    6 |   int n,a[n],b[n],s[101]={};
      |       ^
            
            ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n,a[n],b[n],s[101]={};
  cin >> n;
  for(int i=0;i<n;i++)cin >> a[i];
  for(int i=0;i<n;i++){
    cin >> b[i];
    s[b[i]]+=a[i];
  }
  cout << (s[0] == *max_element(s,s+101)? "YES":"NO") << endl;
  return 0;
}
            
            
            
        
            
xuelei