Rezultati

Up. imeNalogaJezikRezultatČas oddaje
asmx64-2019 Moderna umetnost C++ 100/100OK 09. maj '19 @ 16:53

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 3,195 MiB 0,004 s OK
#2 [več] 20/20 3,195 MiB 0,004 s OK
#3 [več] 20/20 3,195 MiB 0,004 s OK
#4 [več] 20/20 3,043 MiB 0,000 s OK
#5 [več] 20/20 3,195 MiB 0,000 s OK

Ocenjevani program (moderna.cpp):
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;

int platno[100][100];
int w, h;
string znak = " .:-=+*$#%@";

int main() {
	memset(platno, 0, sizeof platno);
	int n;
	int rez = 0;
	cin >> w >> h >> n;

	while (n--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--;
		b--;
		c--;
		d--; 

		if (a > c) swap(a, c);
		if (b > d) swap(b, d);

		a = max(a, 0);
		b = max(b, 0);
		c = min(c, w - 1);
		d = min(d, h - 1);
		
		bool on = false;
		for (int i = a; i <= c; ++i) {
			for (int j = b; j <= d; ++j) {
				platno[i][j]++;
				on = true;
			}
		}
		if (on) rez++;
	}

	cout << '+';
	for (int i = 0; i < w; ++i)
		cout << '-';
	cout << "+\n";

	for (int j = 0; j < h; ++j) {
		cout << '|';
		for (int i = 0; i < w; ++i) {
			if (platno[i][j] > 10) platno[i][j] = 10;
			cout << znak[platno[i][j]];
		}
		cout << '|' << '\n';
	}

	cout << '+';
	for (int i = 0; i < w; ++i)
		cout << '-';
	cout << "+\n";

	cout << rez << " pravokotnikov na belem\n";
}