Submission #7594092


Source Code Expand

Copy
n = int(input())
import numpy as np
s = np.array([{"W":0,"E":1}[i] for i in input()])
cse = np.cumsum(s)
csw = np.cumsum(s==0)
s = s.tolist()
print(min([csw[max(0,i-1)]-csw[0] + cse[-1]-cse[min(n-1,i+1)] for i in range(n)]))

Submission Info

Submission Time
Task C - Attention
User KazukiUruma
Language Python3 (3.4.3)
Score 0
Code Size 230 Byte
Status
Exec Time 834 ms
Memory 34048 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 0 / 300 sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt
Case Name Status Exec Time Memory
sample_01.txt 149 ms 12388 KB
sample_02.txt 151 ms 12388 KB
sample_03.txt 149 ms 12388 KB
subtask_1_01.txt 692 ms 29712 KB
subtask_1_02.txt 262 ms 15420 KB
subtask_1_03.txt 552 ms 24892 KB
subtask_1_04.txt 548 ms 24768 KB
subtask_1_05.txt 365 ms 18540 KB
subtask_1_06.txt 767 ms 33960 KB
subtask_1_07.txt 817 ms 31964 KB
subtask_1_08.txt 730 ms 31432 KB
subtask_1_09.txt 630 ms 27400 KB
subtask_1_10.txt 800 ms 31992 KB
subtask_1_11.txt 778 ms 32000 KB
subtask_1_12.txt 780 ms 34048 KB
subtask_1_13.txt 780 ms 32000 KB
subtask_1_14.txt 813 ms 34048 KB
subtask_1_15.txt 762 ms 32000 KB
subtask_1_16.txt 783 ms 32044 KB
subtask_1_17.txt 809 ms 31992 KB
subtask_1_18.txt 767 ms 31996 KB
subtask_1_19.txt 748 ms 32036 KB
subtask_1_20.txt 834 ms 32000 KB