結果

問題 No.870 無敵囲い
ユーザー kat0rikkat0rik
提出日時 2019-09-02 13:18:22
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 300 ms
コード長 757 bytes
コンパイル時間 15,144 ms
コンパイル使用メモリ 218,788 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 06:22:24
合計ジャッジ時間 10,075 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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