結果

問題 No.185 和風
ユーザー mkanenobu
提出日時 2018-03-24 19:38:43
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 407 bytes
コンパイル時間 2,867 ms
コンパイル使用メモリ 67,148 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 05:31:26
合計ジャッジ時間 3,276 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils, strutils

var
    n = readLine(stdin).parseInt
    xy:seq[seq[int]] = @[]
    res:seq[int] = @[]

for i in 0..<n:
    xy.add(readLine(stdin).split.map(parseInt))

proc main():int =
    for j in xy:
        if j[0] >= j[1]:
            return -1
        else:
            res.add(j[1] - j[0])
    if len(deduplicate(res)) != 1:
        return -1
    else:
        return res[0]

echo main()
0