結果
問題 | No.870 無敵囲い |
ユーザー |
|
提出日時 | 2019-10-29 17:26:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 300 ms |
コード長 | 2,041 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 116,728 KB |
実行使用メモリ | 27,400 KB |
最終ジャッジ日時 | 2024-06-29 06:26:51 |
合計ジャッジ時間 | 2,001 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Runtime.CompilerServices; //using System.Web.UI; using Debug = System.Diagnostics.Debug; // using System.Drawing.Primitives; using System.Drawing; using System.Windows; namespace ConsoleApp1 { class Program { static void Main(string[] args) { new Solver().Solve(); } } class Solver { public const double inf = double.PositiveInfinity; readonly TextWriter error = Console.Error; private void Rep(int n_, Action<int> action) { for (int i = 0; i < n_; i++) { action(i); } } public string ReadLine() { return Console.ReadLine(); } public int Stoi(string s) { return int.Parse(s); } int n; public void Solve() { n = int.Parse(ReadLine()); var x = new int[n, 3]; var y = new int[n, 3]; Rep(n, (i) => { var a = ReadLine().Split(' ').Select(s => Stoi(s)).ToArray(); //Rep(2, (j) => //{ // x[i, 1 + j] = a[2 * j]; // y[i, 1 + j + 1] = a[2 * j]; //}); x[i, 1] = a[0]; y[i, 1] = a[1]; x[i, 2] = a[2]; y[i, 2] = a[3]; }); var cur = new int[10, 10]; cur[2, 8] = 1; cur[3, 9] = 2; cur[7, 9] = 3; Rep(n, (i) => { cur[x[i, 2], y[i, 2]] = cur[x[i, 1], y[i, 1]]; cur[x[i, 1], y[i, 1]] = 0; }); bool ok = false; if (cur[5, 8] == 1 && cur[4, 8] == 2 && cur[6, 8] == 3) ok = true; Console.WriteLine(ok ? "YES" : "NO"); } } }