結果

問題 No.216 FAC
ユーザー nCk_cvnCk_cv
提出日時 2015-08-03 02:37:04
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 891 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 55,704 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 00:42:28
合計ジャッジ時間 7,455 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 1 ms
4,376 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <climits>
#include <vector>
#include <algorithm>
#include <queue>
#include <stdio.h>
#include <string>
#include <memory.h>


#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 99999999

using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    
    int a[n];
    int b[n];
    for(int i = 0; i < n; i++) {
        scanf("%d",&a[n]);
    }
    for(int i = 0; i < n; i++) {
        scanf("%d",&b[n]);
    }
    int score[n+1];
    memset(score, 0, n+1);
    for(int i = 0; i < n; i++) {
        score[b[i]] += a[i];
    }
    
    for(int i = 1; i < n+1; i++) {
        if(score[0] < score[i]) {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    
    
    
    
    
    
    
    
    

}







0