Submission #5048458
Source Code Expand
N = int(input())
S = input()
white = [0]*(N+2)
black = [0]*(N+2)
black[0] = 0
white[N] = 0
for i in range(N):
if S[i] == "#":
black[i+1] = black[i]+1
else:
black[i+1] = black[i]
if S[N-i-1] == ".":
white[N-i-1] = white[N-i]+1
else:
white[N-i-1] = white[N-i]
count_min = 2 * 10 ** 6
for i in range(N+1):
if black[i]+white[i] < count_min:
count_min = black[i]+white[i]
print(count_min)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Stones |
| User | mofumofu1 |
| Language | Python (3.4.3) |
| Score | 300 |
| Code Size | 476 Byte |
| Status | AC |
| Exec Time | 222 ms |
| Memory | 12900 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 196 ms | 12704 KiB |
| 02.txt | AC | 197 ms | 12724 KiB |
| 03.txt | AC | 207 ms | 12796 KiB |
| 04.txt | AC | 205 ms | 12772 KiB |
| 05.txt | AC | 189 ms | 12684 KiB |
| 06.txt | AC | 201 ms | 12760 KiB |
| 07.txt | AC | 222 ms | 12740 KiB |
| 08.txt | AC | 220 ms | 12740 KiB |
| 09.txt | AC | 192 ms | 12708 KiB |
| 10.txt | AC | 199 ms | 12712 KiB |
| 11.txt | AC | 190 ms | 12776 KiB |
| 12.txt | AC | 195 ms | 12900 KiB |
| 13.txt | AC | 193 ms | 12772 KiB |
| 14.txt | AC | 189 ms | 12776 KiB |
| 15.txt | AC | 206 ms | 12712 KiB |
| 16.txt | AC | 206 ms | 12772 KiB |
| 17.txt | AC | 190 ms | 12772 KiB |
| 18.txt | AC | 198 ms | 12712 KiB |
| 19.txt | AC | 17 ms | 3064 KiB |
| 20.txt | AC | 17 ms | 3064 KiB |
| 21.txt | AC | 17 ms | 3064 KiB |
| 22.txt | AC | 17 ms | 3064 KiB |
| s1.txt | AC | 17 ms | 3064 KiB |
| s2.txt | AC | 17 ms | 3064 KiB |
| s3.txt | AC | 17 ms | 3064 KiB |