結果
問題 | No.451 575 |
ユーザー |
![]() |
提出日時 | 2016-12-02 02:51:55 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 838 bytes |
コンパイル時間 | 2,644 ms |
コンパイル使用メモリ | 65,780 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 20:47:05 |
合計ジャッジ時間 | 5,602 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 8 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import strutils, sequtils, math var a = newSeq[int64](100010) proc f(i, n: int, b: seq[int64]): bool = if i > n: return true if i mod 2 == 0: a[i] = a[i-1] - b[i-1] if a[i] <= 0 or 10^18 < a[i]: return false return f(i+1, n, b) else: a[i] = b[i-1] - a[i-1] if a[i] <= 0 or 10^18 < a[i]: return false return f(i+1, n, b) when isMainModule: var n = stdin.readLine.parseInt b = newSeq[int64](n) tmp: seq[int64] = @[] for i in 0..n-1: b[i] = stdin.readLine.parseBiggestInt var l: int64 = -1 u: int64 = 10^18 + 1 while u - l > 1: let m: int64 = (u + l) div 2 a[0] = m if f(1, n, b): l = m else: u = m for i in max(1, l-100)..min(10^18, u+100): a[0] = i if f(1, n, b): echo n+1 for i in 0..n: echo a[i] quit() echo "-1"