Submission #2245048
Source Code Expand
import strutils import sequtils import algorithm import math import queues import tables import logging import future const INF* = int(1e18 + 373) when not defined(release): addHandler(newFileLogger(stderr, lvlAll, "[ $levelname ] ")) proc readInt1*(): int = stdin.readLine().strip().parseInt() proc readInt2*(): (int, int) = let v = stdin.readLine().strip().split().map(parseInt) return (v[0], v[1]) proc readInt3*(): (int, int, int) = let v = stdin.readLine().strip().split().map(parseInt) return (v[0], v[1], v[2]) proc readSeq*(): seq[string] = stdin.readLine().strip().split() proc readSeq*(n: Natural): seq[string] = result = newSeq[string](n) for i in 0..<n: result[i] = stdin.readLine().strip() type seq2*[T] = seq[seq[T]] proc newSeq2*[T](n1, n2: Natural): seq2[T] = newSeqWith(n1, newSeq[T](n2)) #------------------------------------------------------------------------------# proc main() = let n = readInt1() let a = readSeq() var ans = 0 var i = 0 while i < n: debug i let s = i while i < n and a[s] == a[i]: i += 1 if i < n and a[i - 1] < a[i]: while i < n and a[i - 1] <= a[i]: i += 1 else: while i < n and a[i - 1] >= a[i]: i += 1 ans += 1 echo ans main()
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | somq14 |
Language | Nim (0.13.0) |
Score | 0 |
Code Size | 1338 Byte |
Status | WA |
Exec Time | 16 ms |
Memory | 7808 KB |
Compile Error
Hint: system [Processing] Hint: Main [Processing] Hint: strutils [Processing] Hint: parseutils [Processing] Hint: sequtils [Processing] Hint: algorithm [Processing] Hint: math [Processing] Hint: times [Processing] Hint: queues [Processing] Hint: tables [Processing] Hint: hashes [Processing] Hint: etcpriv [Processing] Hint: logging [Processing] Hint: os [Processing] Hint: posix [Processing] lib/pure/logging.nim(128, 22) Hint: 'Exception' is declared but not used [XDeclaredButNotUsed] Hint: future [Processing] Hint: macros [Processing] Hint: [Link] Hint: operation successful (23861 lines compiled; 2.578 sec total; 24.245MB; Release Build) [SuccessX]
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | WA | 10 ms | 4224 KB |
subtask_1_02.txt | WA | 6 ms | 4092 KB |
subtask_1_03.txt | WA | 4 ms | 2172 KB |
subtask_1_04.txt | WA | 16 ms | 7808 KB |
subtask_1_05.txt | WA | 13 ms | 7808 KB |
subtask_1_06.txt | WA | 16 ms | 7808 KB |
subtask_1_07.txt | WA | 16 ms | 7808 KB |
subtask_1_08.txt | WA | 13 ms | 7808 KB |
subtask_1_09.txt | WA | 16 ms | 7808 KB |
subtask_1_10.txt | AC | 1 ms | 256 KB |
subtask_1_11.txt | AC | 1 ms | 256 KB |