結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-04 13:39:29 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 515 bytes |
| コンパイル時間 | 9,502 ms |
| コンパイル使用メモリ | 222,604 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-08 02:21:15 |
| 合計ジャッジ時間 | 10,558 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 WA * 4 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func main() {
sc := bufio.NewScanner(os.Stdin)
sc.Scan()
N, _ := strconv.Atoi(sc.Text())
xs := make([]int, N)
sc.Scan()
strs := strings.Split(sc.Text(), " ")
for i := range strs {
xs[i], _ = strconv.Atoi(strs[i])
}
sort.Ints(xs)
min := 1000001
for i := 0; i < N-1; i++ {
if xs[i+1]-xs[i] < min && xs[i+1] != xs[i] {
min = xs[i+1] - xs[i]
}
}
if min == 1000001 {
fmt.Println("0")
} else {
fmt.Println(min)
}
}