Submission #2511407


Source Code Expand

N,M = map(int,input().split())
src = [input() for i in range(M)]

w_cum = [0]
for col in zip(*src):
    w_cum.append(w_cum[-1] + col.count('W'))

ans = -1
min_d = N*M
for i in range(N+1):
    ww = w_cum[i]
    we = M*i - ww
    ew = w_cum[-1] - ww
    if we + ew < min_d:
        min_d = we + ew
        ans = i
print(ans, ans+1)

Submission Info

Submission Time
Task A - Where is the Boundary
User prd_xxx
Language Python (3.4.3)
Score 100
Code Size 345 Byte
Status AC
Exec Time 53 ms
Memory 4340 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 26
Set Name Test Cases
All 00_sample_00, 00_sample_01, 00_sample_02, 00_sample_03, 01_random_small_00, 01_random_small_01, 01_random_small_02, 01_random_small_03, 01_random_small_04, 01_random_small_05, 02_random_large_00, 02_random_large_01, 02_random_large_02, 02_random_large_03, 02_random_large_04, 02_random_large_05, 03_random_biased_00, 03_random_biased_01, 03_random_biased_02, 03_random_biased_03, 04_random_reverse_biased_00, 04_random_reverse_biased_01, 04_random_reverse_biased_02, 04_random_reverse_biased_03, 05_min_00, 05_min_01
Case Name Status Exec Time Memory
00_sample_00 AC 17 ms 3064 KB
00_sample_01 AC 17 ms 3064 KB
00_sample_02 AC 17 ms 3064 KB
00_sample_03 AC 17 ms 3060 KB
01_random_small_00 AC 18 ms 3060 KB
01_random_small_01 AC 17 ms 2940 KB
01_random_small_02 AC 18 ms 3064 KB
01_random_small_03 AC 18 ms 3064 KB
01_random_small_04 AC 18 ms 3060 KB
01_random_small_05 AC 18 ms 3060 KB
02_random_large_00 AC 51 ms 4340 KB
02_random_large_01 AC 51 ms 4340 KB
02_random_large_02 AC 53 ms 4340 KB
02_random_large_03 AC 51 ms 4340 KB
02_random_large_04 AC 52 ms 4340 KB
02_random_large_05 AC 51 ms 4340 KB
03_random_biased_00 AC 50 ms 4340 KB
03_random_biased_01 AC 51 ms 4340 KB
03_random_biased_02 AC 52 ms 4340 KB
03_random_biased_03 AC 51 ms 4340 KB
04_random_reverse_biased_00 AC 51 ms 4340 KB
04_random_reverse_biased_01 AC 51 ms 4340 KB
04_random_reverse_biased_02 AC 51 ms 4340 KB
04_random_reverse_biased_03 AC 51 ms 4340 KB
05_min_00 AC 17 ms 3064 KB
05_min_01 AC 17 ms 2940 KB