Untitled

mail@pastecode.io avatar
unknown
plain_text
4 months ago
1.4 kB
3
Indexable
#include <bits/stdc++.h>

using namespace std;

#define Task "test"
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORD(i, a, b) for(int i = (a); i <= (b); ++i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define endl "\n"
#define int long long
#define Chris_No_Luv signed main()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> vi;
typedef vector<int> vii;
typedef set<int> viii;
typedef map<int, int> viiii;

const int mod = (int) 1e9 + 7;
const int INF = (int) 1e9 + 2804;

const int sett = 100;
const int SIZE = 201;
int n;

Chris_No_Luv
{
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    if (fopen(Task".inp", "r"))
    {
    freopen(Task".inp", "r", stdin);
    freopen(Task".out", "w", stdout);
    }
    cin >> n;
    vector<bool> grid(SIZE * SIZE, false);
    FOR(i, 0, n)
    {
        int x1, x2, y1, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += sett;
        y1 += sett;
        x2 += sett;
        y2 += sett;
        FOR(x, x1, x2)
        {
            FOR(y, y1, y2)
            {
                grid[x * SIZE + y] = true;
            }
        }
    }
    int ca = 0;
    FOR(i, 0, SIZE * SIZE)
    {
        if(grid[i])
        {
            ca++;
        }
    }
    cout << ca;
    return 0;
}
Leave a Comment