Submission #17085812
Source Code Expand
use proconio::input;
fn main() {
input! {
n: usize,
a: [i64; n],
};
let mut s = 0;
let mut c = 0;
for &a_i in a.iter() {
if a_i == 0 {
s += c / 2;
c = 0;
} else {
c += a_i;
}
}
if c > 0 {
s += c / 2;
}
let ans = s;
println!("{}", ans);
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Simplified mahjong |
| User | bouzuya |
| Language | Rust (1.42.0) |
| Score | 400 |
| Code Size | 363 Byte |
| Status | AC |
| Exec Time | 19 ms |
| Memory | 3684 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 16 ms | 3572 KiB |
| 02.txt | AC | 10 ms | 3508 KiB |
| 03.txt | AC | 13 ms | 3516 KiB |
| 04.txt | AC | 16 ms | 3132 KiB |
| 05.txt | AC | 9 ms | 3068 KiB |
| 06.txt | AC | 14 ms | 3068 KiB |
| 07.txt | AC | 15 ms | 3436 KiB |
| 08.txt | AC | 16 ms | 3292 KiB |
| 09.txt | AC | 19 ms | 3520 KiB |
| 10.txt | AC | 15 ms | 3556 KiB |
| 11.txt | AC | 8 ms | 2744 KiB |
| 12.txt | AC | 17 ms | 3684 KiB |
| 13.txt | AC | 11 ms | 3536 KiB |
| 14.txt | AC | 17 ms | 3592 KiB |
| 15.txt | AC | 6 ms | 2856 KiB |
| 16.txt | AC | 19 ms | 3536 KiB |
| 17.txt | AC | 11 ms | 3508 KiB |
| 18.txt | AC | 3 ms | 2020 KiB |
| 19.txt | AC | 2 ms | 1892 KiB |
| 20.txt | AC | 2 ms | 2092 KiB |
| 21.txt | AC | 2 ms | 2080 KiB |
| 22.txt | AC | 2 ms | 2020 KiB |
| s1.txt | AC | 2 ms | 1940 KiB |
| s2.txt | AC | 2 ms | 2032 KiB |