Submission #4240686
Source Code Expand
import sys stdin = sys.stdin sys.setrecursionlimit(10**8) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return list(ns()) def ni(): return int(stdin.readline()) def nf(): return float(stdin.readline()) n = ni() a = [ni() for _ in range(n)] cnt = {i+1: ai for i, ai in enumerate(a)} prev = -100 cur = 0 ans = 0 for key in sorted(cnt.keys()): if cnt[key] == 0: continue if prev == -100: prev = key if (key-prev) < 2: cur += cnt[key] else: cur = cnt[key] ans += cur // 2 cur -= 2 * (cur//2) prev = key print(ans)
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | polarbear08 |
Language | Python (3.4.3) |
Score | 400 |
Code Size | 874 Byte |
Status | AC |
Exec Time | 164 ms |
Memory | 19100 KB |
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 | 141 ms | 19100 KB |
02.txt | AC | 152 ms | 19100 KB |
03.txt | AC | 143 ms | 19084 KB |
04.txt | AC | 111 ms | 17536 KB |
05.txt | AC | 115 ms | 17428 KB |
06.txt | AC | 113 ms | 17412 KB |
07.txt | AC | 132 ms | 18452 KB |
08.txt | AC | 132 ms | 18440 KB |
09.txt | AC | 149 ms | 19092 KB |
10.txt | AC | 144 ms | 19092 KB |
11.txt | AC | 81 ms | 15864 KB |
12.txt | AC | 155 ms | 19088 KB |
13.txt | AC | 146 ms | 19084 KB |
14.txt | AC | 144 ms | 19084 KB |
15.txt | AC | 110 ms | 15896 KB |
16.txt | AC | 164 ms | 19100 KB |
17.txt | AC | 147 ms | 19100 KB |
18.txt | AC | 17 ms | 3064 KB |
19.txt | AC | 17 ms | 3064 KB |
20.txt | AC | 17 ms | 3064 KB |
21.txt | AC | 17 ms | 3064 KB |
22.txt | AC | 17 ms | 3064 KB |
s1.txt | AC | 17 ms | 3064 KB |
s2.txt | AC | 17 ms | 3064 KB |