Please sign in first.
Submission #30243254
Source Code Expand
N,*A = $<.read.split.map &:to_i
r=i=o=x=y = 0
while N > l=r
a = A[r=l]
0 while a == A[r+=1]
l = r - l
if a > 0
y < i += l and y = i
0 > o -= l and o = 0
else
x < o += l and x = o
0 > i -= l and i = 0
end
end
p x+y+1
Submission Info
| Submission Time | |
|---|---|
| Task | B - Count 1's |
| User | l0rzl |
| Language | Ruby (2.7.1) |
| Score | 400 |
| Code Size | 255 Byte |
| Status | AC |
| Exec Time | 141 ms |
| Memory | 34532 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt, 01-023.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 53 ms | 14196 KiB |
| 00-sample-002.txt | AC | 53 ms | 14228 KiB |
| 00-sample-003.txt | AC | 55 ms | 14128 KiB |
| 01-001.txt | AC | 53 ms | 14212 KiB |
| 01-002.txt | AC | 116 ms | 32760 KiB |
| 01-003.txt | AC | 108 ms | 29776 KiB |
| 01-004.txt | AC | 79 ms | 21620 KiB |
| 01-005.txt | AC | 59 ms | 14460 KiB |
| 01-006.txt | AC | 87 ms | 22996 KiB |
| 01-007.txt | AC | 64 ms | 16668 KiB |
| 01-008.txt | AC | 56 ms | 14936 KiB |
| 01-009.txt | AC | 76 ms | 19732 KiB |
| 01-010.txt | AC | 58 ms | 14572 KiB |
| 01-011.txt | AC | 56 ms | 14924 KiB |
| 01-012.txt | AC | 63 ms | 16288 KiB |
| 01-013.txt | AC | 119 ms | 34488 KiB |
| 01-014.txt | AC | 119 ms | 34532 KiB |
| 01-015.txt | AC | 129 ms | 34464 KiB |
| 01-016.txt | AC | 130 ms | 34244 KiB |
| 01-017.txt | AC | 122 ms | 34384 KiB |
| 01-018.txt | AC | 119 ms | 34532 KiB |
| 01-019.txt | AC | 118 ms | 34352 KiB |
| 01-020.txt | AC | 141 ms | 34228 KiB |
| 01-021.txt | AC | 118 ms | 34284 KiB |
| 01-022.txt | AC | 137 ms | 34396 KiB |
| 01-023.txt | AC | 117 ms | 34284 KiB |