Submission #7680247
Source Code Expand
#!/usr/bin/env python3
import sys
def solve(n: int, p: "List[int]"):
result = 0
for i in range(len(p) - 2):
if p[i] < p[i + 1] and p[i + 1] < p[i + 2]:
result += 1
elif p[i] > p[i + 1] and p[i + 1] > p[i + 2]:
result += 1
print(result)
return
# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
n = int(next(tokens)) # type: int
p = [int(next(tokens)) for _ in range(n)] # type: "List[int]"
solve(n, p)
if __name__ == '__main__':
main()
Submission Info
| Submission Time | |
|---|---|
| Task | B - Ordinary Number |
| User | showwin |
| Language | Python (3.4.3) |
| Score | 200 |
| Code Size | 794 Byte |
| Status | AC |
| Exec Time | 17 ms |
| Memory | 3064 KiB |
Judge Result
| Set Name | All | Sample | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 200 / 200 | 0 / 0 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| All | sample_01, sample_02, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12 |
| Sample | sample_01, sample_02 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01 | AC | 17 ms | 3064 KiB |
| sample_02 | AC | 17 ms | 3064 KiB |
| testcase_01 | AC | 17 ms | 3064 KiB |
| testcase_02 | AC | 17 ms | 3064 KiB |
| testcase_03 | AC | 17 ms | 3064 KiB |
| testcase_04 | AC | 17 ms | 3064 KiB |
| testcase_05 | AC | 17 ms | 3064 KiB |
| testcase_06 | AC | 17 ms | 3064 KiB |
| testcase_07 | AC | 17 ms | 3064 KiB |
| testcase_08 | AC | 17 ms | 3064 KiB |
| testcase_09 | AC | 17 ms | 3064 KiB |
| testcase_10 | AC | 17 ms | 3064 KiB |
| testcase_11 | AC | 17 ms | 3064 KiB |
| testcase_12 | AC | 17 ms | 3064 KiB |