Rezultati

Up. imeNalogaJezikRezultatČas oddaje
4c-2019 Moderna umetnost C# 0/100Napaka med izvajanjem / ob izhodu (RTE) 09. maj '19 @ 19:13

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 0/20 22,109 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at ConsoleApp1.Program.Main () <0x4148cd50 + 0x00301> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at ConsoleApp1.Program.Main () <0x4148cd50 + 0x00301> in <filename unknown>:0 
#2 [več] 20/20 20,504 MiB 0,000 s OK
#3 [več] 20/20 18,578 MiB 0,000 s OK
#4 [več] 20/20 18,578 MiB 0,000 s OK
#5 [več] 0/20 20,211 MiB 1,558 s Program je končal z neničelno kodo
Stderr:
Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at ConsoleApp1.Program.Main () <0x40fcad50 + 0x00301> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at ConsoleApp1.Program.Main () <0x40fcad50 + 0x00301> in <filename unknown>:0 

Ocenjevani program (Program.cs):
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
	class Program
	{
		static void Main()
		{
			const string Barve = " .:-=+*$#%@";
			string [] input = Console.ReadLine().Split(' ');
			int W = Int32.Parse(input[0]);
			int H = Int32.Parse(input[1]);
			int N = Int32.Parse(input[2]);
			bool aaa = false;
			int stPravokotnikov = N;
			int[,] Polje = new int[H+2, W+2];
			for (int i = 0; i < N; i++)
			{
				aaa = false;
				string[] kvadrat = Console.ReadLine().Split(' ');
				int a = Int32.Parse(kvadrat[0]);
				int b = Int32.Parse(kvadrat[1]);
				int c = Int32.Parse(kvadrat[2]);
				int d = Int32.Parse(kvadrat[3]);
				if (a > c)
				{
					int temp = a;
					a = c;
					c = temp;
				}

				if (b > d)
				{
					int temp = b;
					b = d;
					d = temp;
				}



				for (; a <= c;a++)
				{
					if (a == (W + 1))
					{
						break;
					}
					for (int b1=b; b1 <= d;b1++)
					{
						if (b1 == (H + 1))
						{
							break;
						}
						if (b1 > 0 && a > 0)
						{
							aaa = true;
							Polje[b1, a]++;
						}
					}
				}
				if (!aaa)
					stPravokotnikov--;
			}

			for (int y = 0; y <= (H+1); y++)
			{
				string temp = String.Empty;
				for (int x = 0; x <= (W+1); x++)
				{
					if (x == 0 || x == (W+1))
					{
						if (y == 0 || y == (H+1))
							temp += '+';
						else
							temp += '|';
					}
					else if (y==0 || y==(H+1))
					{
						temp += '-';
					}
					else
					{
						int barva = Polje[y, x];
						if (barva > 10)
							barva = 10;
						temp += Barve[barva];
					}
				}
				Console.WriteLine(temp);
			}
			Console.WriteLine("{0} pravokotnikov na belem", stPravokotnikov);
		}
	}
}