Rezultati

Up. imeNalogaJezikRezultatČas oddaje
the-org-2019 Moderna umetnost C++ 100/100OK 09. maj '19 @ 17:30

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 3,059 MiB 0,000 s OK
#2 [več] 20/20 3,262 MiB 0,000 s OK
#3 [več] 20/20 3,262 MiB 0,000 s OK
#4 [več] 20/20 3,105 MiB 0,000 s OK
#5 [več] 20/20 3,262 MiB 0,007 s OK

Ocenjevani program (main.cpp):
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int matt[105][105];

int res[1005][3];

int N, M;
int n1, n2;
string tmp;

int main()
{
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> m >> n >> k;
    int br = 0;
    for (int i = 0; i < k; i++) {
        int a,b,c,d;
        cin >> b >> a >> d >> c;
        if (a <= 0 && c <= 0)
        continue;
        if (a > n && c > n)
        continue;
        if (b <= 0 && d <= 0)
        continue;
        if (b > m && d > m)
        continue;
        br ++;
        if (a <= 0)
        a = 1;
        if (b <= 0)
        b = 1;
        if (c <= 0)
        c = 1;
        if (d <= 0)
        d = 1;
        if (a > n)
        a = n;
        if (b > m)
        b = m;
        if (c > n)
        c = n;
        if (d > m)
        d = m;
        if (a <= c) {
            for (int i = a; i <= c; i++) {
                if (b <= d) {
                    for (int j = b; j <= d; j++) {
                        matt[i][j]++;
                    }
                }
                else {
                    for (int j = b; j >= d; j--) {
                        matt[i][j]++;
                    }
                }
            }
        }
        else {
            for (int i = a ; i >= c; i--) {
            if (b <= d) {
                    for (int j = b; j <= d; j++) {
                        matt[i][j]++;
                    }
                }
                else {
                    for (int j = b; j >= d; j--) {
                        matt[i][j]++;
                    }
                }
            }
        }
    }

    char mat[n+5][m+5];
    for (int i = 0; i <= n+1; i++) {
        for (int j = 0; j <= m+1;j++)
        mat[i][j] = ' ';
    }
    string ss = " .:-=+*$#%@";
    mat[0][0] ='+';
    mat[0][m+1] = '+';
    mat[n+1][0] = '+';
    mat[n+1][m+1] = '+';
    for (int i = 1; i <= m; i++)
    mat[0][i] = '-',mat[n+1][i] = '-';
    for (int i = 1; i <= n; i++)
    mat[i][0] ='|',mat[i][m+1] = '|';

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <=m;j++) {
            if (matt[i][j] >= 10)
            matt[i][j] = 10;
            mat[i][j] = ss[matt[i][j]];
        }
    }
    for (int i = 0; i <= n+1; i++) {
        for (int j = 0; j <= m+1;j++) {
            cout<<mat[i][j];
        }
        cout<<endl;
    }
    cout<<br<<" pravokotnikov na belem"<<endl;

    return 0;
}