結果

問題 No.870 無敵囲い
ユーザー kat0rikkat0rik
提出日時 2019-09-02 13:18:22
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 300 ms
コード長 757 bytes
コンパイル時間 11,959 ms
コンパイル使用メモリ 216,040 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 16:16:25
合計ジャッジ時間 13,025 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

type point struct {
	x, y int
}

func check(here, from point) bool {
	return here.x == from.x && here.y == from.y
}

func main() {
	var n int
	fmt.Scan(&n)
	from := make([]point, n)
	to := make([]point, n)
	for i := range from {
		fmt.Scan(&from[i].x, &from[i].y)
		fmt.Scan(&to[i].x, &to[i].y)
	}
	a, b, c := point{2, 8}, point{3, 9}, point{7, 9}
	ta, tb, tc := point{5, 8}, point{4, 8}, point{6, 8}
	for i := range from {
		if check(a, from[i]) {
			a.x = to[i].x
			a.y = to[i].y
		} else if check(b, from[i]) {
			b.x = to[i].x
			b.y = to[i].y
		} else if check(c, from[i]) {
			c.x = to[i].x
			c.y = to[i].y
		}
	}
	if check(a, ta) && check(b, tb) && check(c, tc) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0