Submission #715179

#TimeUsernameProblemLanguageResultExecution timeMemory
715179aykhnExamination (JOI19_examination)C++14
2 / 100
3057 ms1232 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define OPT ios_base::sync_with_stdio(0); \
            cin.tie(0); \
            cout.tie(0)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) \
                    cout << v[i] << " "; \
                    cout<<endl;

struct DSU {
	vector<int> e;

	void init(int n)
	{
	    e.assign(n, -1);
	}

	int get(int x)
	{
	    if (e[x] < 0)
            return x;
        return get(e[x]);
	}

	bool together(int a, int b)
	{
	    if (get(a) == get(b))
            return true;
        return false;
	}

	int s(int x)
	{
	    return -e[get(x)];
	}

	bool un(int x, int y)
	{
		x = get(x);
        y = get(y);

		if (x == y) return false;

		if (e[x] > e[y]) swap(x, y);

		e[x] += e[y];
		e[y] = x;

		return true;
	}
};

int n;

int main()
{
    int q;
    cin >> n >> q;

    vector<pii> v(n);

    for (int i = 0; i < n; i++)
    {
        cin >> v[i].fi >> v[i].se;
    }

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

        int cnt = 0;

        for (int i = 0; i < n; i++)
        {
            if (v[i].fi >= a && v[i].se >= b && v[i].fi + v[i].se >= c)
            {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...