Submission #3026848


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;

namespace arc076_c
{
	class Program
	{
		static int[] arr;
		static bool IsOK(int index, int key)
		{
			if (arr[index] > key) return true;
			else return false;
		}
		static int Binary_search(int key)
		{
			int ng = -1;
			int ok = arr.Count();

			while (ok - ng > 1)
			{
				int mid = ng + (ok - ng) / 2;

				if (IsOK(mid, key)) ok = mid;
				else ng = mid;
			}

			return ok;
		}
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			SortedSet<int> list = new SortedSet<int>();
			bool ret = true;
			for (int i = 0; i < x[2]; i++)
			{
				int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
				if ((a[0] == 0 || a[0] == x[0] || a[1] == 0 || a[1] == x[1]) && (a[2] == 0 || a[2] == x[0] || a[3] == 0 || a[3] == x[1]))
				{
					int n1 = 0;
					if (a[0] == 0) n1 += a[1];//up
					else
					{
						n1 += x[1];
						if (a[1] == x[1]) n1 += a[0];//right
						else
						{
							n1 += x[0];
							if (a[0] == x[0]) n1 += x[1] - a[1];//down
							else//left
							{
								n1 += x[1];
								n1 += x[0] - a[0];
							}
						}
					}
					int n2 = 0;
					if (a[2] == 0) n2 += a[3];//up
					else
					{
						n2 += x[1];
						if (a[3] == x[1]) n2 += a[2];//right
						else
						{
							n2 += x[0];
							if (a[2] == x[0]) n2 += x[1] - a[3];//down
							else//left
							{
								n2 += x[1];
								n2 += x[0] - a[2];
							}
						}
					}
					arr = list.ToArray();
					if (!(Binary_search(n1) == Binary_search(n2) || 
						(Math.Min(n1, n2) < list.Min && list.Max < Math.Max(n1, n2)))) ret = false;
					list.Add(n1); list.Add(n2);
				}
			}
			Console.WriteLine(ret ? "YES" : "NO");
		}
	}
}

Submission Info

Submission Time
Task E - Connected?
User mencotton
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1844 Byte
Status WA
Exec Time 2109 ms
Memory 36316 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 4
AC × 8
WA × 4
TLE × 26
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 43.txt, 44.txt, 45.txt, 46.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt TLE 2109 ms 34268 KB
02.txt TLE 2109 ms 34268 KB
03.txt TLE 2109 ms 32220 KB
04.txt TLE 2108 ms 32212 KB
05.txt TLE 2109 ms 34268 KB
06.txt TLE 2109 ms 34268 KB
07.txt TLE 2108 ms 34256 KB
08.txt TLE 2109 ms 34268 KB
09.txt TLE 2109 ms 34264 KB
10.txt TLE 2108 ms 36316 KB
11.txt TLE 2109 ms 32220 KB
12.txt WA 230 ms 15772 KB
13.txt TLE 2108 ms 34128 KB
14.txt TLE 2109 ms 34136 KB
15.txt TLE 2109 ms 34136 KB
16.txt WA 1566 ms 32068 KB
17.txt WA 322 ms 17444 KB
18.txt WA 278 ms 17816 KB
19.txt TLE 2108 ms 34264 KB
20.txt TLE 2109 ms 32220 KB
21.txt TLE 2109 ms 34264 KB
22.txt TLE 2109 ms 34136 KB
23.txt TLE 2109 ms 34268 KB
24.txt TLE 2109 ms 34268 KB
25.txt TLE 2109 ms 36316 KB
26.txt TLE 2109 ms 32220 KB
27.txt TLE 2108 ms 32220 KB
28.txt TLE 2109 ms 34268 KB
29.txt TLE 2109 ms 32220 KB
30.txt TLE 2109 ms 34268 KB
43.txt AC 28 ms 13652 KB
44.txt AC 25 ms 11476 KB
45.txt AC 28 ms 13652 KB
46.txt AC 28 ms 11604 KB
s1.txt AC 26 ms 13524 KB
s2.txt AC 28 ms 11604 KB
s3.txt AC 29 ms 13652 KB
s4.txt AC 28 ms 9556 KB