提出 #32749312


ソースコード 拡げる

import numpy as np

n = int(input().strip())
s = input().strip()

W = [int(w) for w in input().strip().split()]


Pes = []
cnt = 0
for st, wgh in zip(s, W):
    if st =="0":
        #st = "-1"
        cnt+=1
    Pes.append([wgh, int(st)])

Pes.sort()

ret = [nu[1] for nu in Pes]
#print(ret)
if Pes[cnt][1]=="1":
    ans = n
else:
    wakeme = cnt #Pes[cnt]から大人
    wakeme1 = 0
    wakeme2 = n-1
    for c in range(cnt-1, 0, -1):
        mae = Pes[c][1]
        if mae == "0":
            wakeme1 = c+1
            break
    for c in range(cnt, n):
        mae = Pes[c][1]
        if mae == "1":
            wakeme2 = c-1
            break

maemae = cnt-sum(ret[:wakeme1])+sum(ret[wakeme1:])
atoato = cnt-sum(ret[:wakeme2])+sum(ret[wakeme2:])
#print(wakeme1, wakeme2)
print(max(maemae, atoato))

提出情報

提出日時
問題 C - Robot Takahashi
ユーザ rsypoz
言語 Python (3.8.2)
得点 0
コード長 844 Byte
結果 RE
実行時間 792 ms
メモリ 56948 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
WA × 2
RE × 1
AC × 3
WA × 29
RE × 3
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
ケース名 結果 実行時間 メモリ
example_00.txt WA 128 ms 26568 KiB
example_01.txt RE 116 ms 26760 KiB
example_02.txt WA 121 ms 26736 KiB
hand_00.txt AC 782 ms 56948 KiB
hand_01.txt RE 724 ms 55484 KiB
hand_02.txt WA 786 ms 55316 KiB
hand_03.txt WA 786 ms 55076 KiB
hand_04.txt AC 778 ms 55812 KiB
hand_05.txt AC 116 ms 26784 KiB
hand_06.txt RE 113 ms 26740 KiB
random_00.txt WA 788 ms 56936 KiB
random_01.txt WA 785 ms 55564 KiB
random_02.txt WA 779 ms 55712 KiB
random_03.txt WA 783 ms 55396 KiB
random_04.txt WA 782 ms 55300 KiB
random_05.txt WA 779 ms 55072 KiB
random_06.txt WA 789 ms 55428 KiB
random_07.txt WA 788 ms 55072 KiB
random_08.txt WA 502 ms 55268 KiB
random_09.txt WA 497 ms 55112 KiB
random_10.txt WA 496 ms 55108 KiB
random_11.txt WA 498 ms 55132 KiB
random_12.txt WA 503 ms 55396 KiB
random_13.txt WA 481 ms 55128 KiB
random_14.txt WA 490 ms 55184 KiB
random_15.txt WA 679 ms 55116 KiB
random_16.txt WA 658 ms 55392 KiB
random_17.txt WA 664 ms 54956 KiB
random_18.txt WA 666 ms 56876 KiB
random_19.txt WA 665 ms 54956 KiB
random_20.txt WA 788 ms 54932 KiB
random_21.txt WA 783 ms 56936 KiB
random_22.txt WA 782 ms 55192 KiB
random_23.txt WA 781 ms 55104 KiB
random_24.txt WA 792 ms 55844 KiB