結果
| 問題 |
No.1170 Never Want to Walk
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-12 00:31:14 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,095 bytes |
| コンパイル時間 | 13,256 ms |
| コンパイル使用メモリ | 238,224 KB |
| 実行使用メモリ | 15,660 KB |
| 最終ジャッジ日時 | 2025-03-12 00:31:33 |
| 合計ジャッジ時間 | 19,263 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 10 TLE * 1 -- * 26 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
var StationList = []int{}
var Answer = []int{}
var Max = 0
var Min = 0
func main() {
sc := bufio.NewScanner(os.Stdin)
ans := ""
sc.Scan()
header := strings.Split(sc.Text(), " ")
Min, _ = strconv.Atoi(header[1])
Max, _ = strconv.Atoi(header[2])
sc.Scan()
for _, s := range strings.Split(sc.Text(), " ") {
v, _ := strconv.Atoi(s)
StationList = append(StationList, v)
}
for i := range StationList {
memo := make([]int, len(StationList))
Answer = append(Answer, i)
rec(i, &memo)
fmt.Println()
ans += fmt.Sprintf("%v\n", len(Answer))
Answer = []int{}
}
fmt.Print(ans)
}
func rec(base int, memo *[]int) {
(*memo)[base] = 1
for i := range StationList {
fmt.Println(base, i)
if (*memo)[i] == 0 {
if judge(base, i) {
Answer = append(Answer, i)
rec(i, memo)
}
}
}
}
func judge(i, j int) bool {
diff := StationList[j] - StationList[i]
if diff < 0 {
diff = StationList[i] - StationList[j]
}
if (Min <= diff) && (diff <= Max) {
return true
} else {
return false
}
}