結果

問題 No.177 制作進行の宮森あおいです!
ユーザー e-mone-mon
提出日時 2015-04-04 00:43:36
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 754 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 8,332 KB
最終ジャッジ日時 2023-08-25 02:02:46
合計ジャッジ時間 1,240 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,816 KB
testcase_01 AC 16 ms
8,228 KB
testcase_02 AC 18 ms
8,280 KB
testcase_03 AC 17 ms
7,812 KB
testcase_04 AC 16 ms
8,192 KB
testcase_05 AC 17 ms
7,788 KB
testcase_06 AC 17 ms
7,856 KB
testcase_07 AC 16 ms
8,308 KB
testcase_08 AC 16 ms
8,296 KB
testcase_09 AC 17 ms
7,784 KB
testcase_10 AC 17 ms
7,820 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 17 ms
8,332 KB
testcase_13 AC 16 ms
8,168 KB
testcase_14 AC 16 ms
7,936 KB
testcase_15 AC 16 ms
8,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

W = int(input())
N = int(input())
J = list(map(int,input().split()))
M = int(input())
C = list(map(int,input().split()))

flow = [[1 for i in range(N)] for j in range(M)]

for i in range(M):
    xs = list(map(int,input().split()))
    for j in xs[1:]:
        flow[i][j-1] = 0

for animator,a_v in sorted(enumerate(J),key=lambda x:-x[1]):
    directors = sorted([(C[i],i) for i in range(M) if flow[i][animator] == 1],key=lambda x:-x[0])
    for d_v,d in directors:
        volume = min(C[d],J[animator])
        C[d] -= volume
        J[animator] -= volume
        W -= volume
        if W <= 0:
            break
    if W <= 0:
        break
else:
    print('BANSAKUTSUKITA')
    quit()
print('SHIROBAKO')
0