Rezultati

Up. imeNalogaJezikRezultatČas oddaje
final-solution-2019 Moderna umetnost C 100/100OK 09. maj '19 @ 16:36

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 1,465 MiB 0,005 s OK
#2 [več] 20/20 1,586 MiB 0,005 s OK
#3 [več] 20/20 1,555 MiB 0,005 s OK
#4 [več] 20/20 1,590 MiB 0,005 s OK
#5 [več] 20/20 1,586 MiB 0,005 s OK

Ocenjevani program (modernaumetnost.c):
#include <stdio.h>

static int B[256][256];

int main() {
    int i = 0, j = 0, w = 0, h = 0, n = 0, m = 0;
    scanf("%d %d %d", &w, &h, &n);
    while (n --> 0) {
        int a = 0, b = 0, c = 0, d = 0;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        if (a > c) {
            int t = a;
            a = c;
            c = t;
        }
        if (b > d) {
            int t = b;
            b = d;
            d = t;
        }
        if (a < 1) a = 1;
        if (b < 1) b = 1;
        if (c > w) c = w;
        if (d > h) d = h;
        if (a <= c && b <= d) m++;
        for (i = b; i <= d; i++) {
            for (j = a; j <= c; j++) {
                if (B[i][j] < 10) B[i][j]++;
            }
        }
    }
    putchar('+');
    for (j = 0; j < w; j++) putchar('-');
    putchar('+');
    putchar('\n');
    for (i = 1; i <= h; i++) {
        putchar('|');
        for (j = 1; j <= w; j++) {
            putchar(" .:-=+*$#%@"[B[i][j]]);
        }
        putchar('|');
        putchar('\n');
    }
    putchar('+');
    for (j = 0; j < w; j++) putchar('-');
    putchar('+');
    putchar('\n');
    printf("%d pravokotnikov na belem\n", m);
    return 0;
}