結果

問題 No.216 FAC
ユーザー fmhrfmhr
提出日時 2015-05-26 22:39:29
言語 Go
(1.22.1)
結果
RE  
実行時間 -
コード長 435 bytes
コンパイル時間 11,837 ms
コンパイル使用メモリ 229,612 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 02:05:11
合計ジャッジ時間 11,615 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	b := make([]int, N)
	c := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
	}
	for i := 0; i < N; i++ {
		fmt.Scan(&b[i])
	}
	var K int
	for i := 0; i < N; i++ {
		if b[i] == 0 {
			K += a[i]
		} else {
			c[b[i]] += a[i]
		}
	}
	for i := 0; i < N; i++ {
		if K < c[i] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}
0