Submission #32832344


Source Code Expand

from itertools import accumulate
def C(N, S, W):
    S = [int(s) for s in S]
    
    W, S = zip(*sorted(
        sorted(zip(W, S), key=lambda ws:ws[1], reverse=True),
        key=lambda ws: ws[0]))
    *S, = accumulate(S)
    return max([i - 2*s for i, s in enumerate(S)]+[-1]) + 1 + S[-1]
 
 
N = int(input())
S = input()
*W, = map(int, input().split())
 
print(C(N, S, W))

Submission Info

Submission Time
Task C - Robot Takahashi
User arakaki_tokyo
Language PyPy3 (7.3.0)
Score 300
Code Size 390 Byte
Status AC
Exec Time 496 ms
Memory 181552 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 35
Set Name Test Cases
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
Case Name Status Exec Time Memory
example_00.txt AC 68 ms 61828 KiB
example_01.txt AC 51 ms 61904 KiB
example_02.txt AC 48 ms 61692 KiB
hand_00.txt AC 454 ms 181552 KiB
hand_01.txt AC 440 ms 181480 KiB
hand_02.txt AC 458 ms 180944 KiB
hand_03.txt AC 462 ms 178340 KiB
hand_04.txt AC 467 ms 180700 KiB
hand_05.txt AC 48 ms 61964 KiB
hand_06.txt AC 51 ms 61780 KiB
random_00.txt AC 478 ms 179052 KiB
random_01.txt AC 480 ms 179176 KiB
random_02.txt AC 483 ms 179028 KiB
random_03.txt AC 496 ms 178712 KiB
random_04.txt AC 471 ms 178924 KiB
random_05.txt AC 477 ms 178980 KiB
random_06.txt AC 482 ms 178856 KiB
random_07.txt AC 484 ms 179136 KiB
random_08.txt AC 390 ms 179308 KiB
random_09.txt AC 382 ms 179844 KiB
random_10.txt AC 385 ms 179860 KiB
random_11.txt AC 387 ms 179644 KiB
random_12.txt AC 398 ms 179776 KiB
random_13.txt AC 376 ms 179828 KiB
random_14.txt AC 379 ms 180020 KiB
random_15.txt AC 443 ms 179024 KiB
random_16.txt AC 444 ms 178828 KiB
random_17.txt AC 439 ms 178616 KiB
random_18.txt AC 440 ms 179384 KiB
random_19.txt AC 442 ms 179232 KiB
random_20.txt AC 488 ms 178512 KiB
random_21.txt AC 484 ms 178556 KiB
random_22.txt AC 483 ms 178984 KiB
random_23.txt AC 473 ms 178692 KiB
random_24.txt AC 484 ms 179016 KiB