제출 #1343665

#제출 시각아이디문제언어결과실행 시간메모리
1343665ayazExamination (JOI19_examination)C++20
2 / 100
3092 ms2416 KiB
// I forgot that I did not solve problem :)
#pragma GCC optimize("O3")

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "algos/debug.h"
#else
#define debug(...) 42;
#endif

#define all(x) (x).begin(), (x).end()
#define isz(x) (int)x.size()
#define int long long

const int sz = 2e5 + 1, inf = 1e9, mod = 1e9 + 7;
array<int, 2> a[sz];
struct MergeSortTree {};
void run(int tc) {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i][0] >> a[i][1];
  }
  sort(a + 1, a + 1 + n);
  while (q--) {
    int x, y, z;
    cin >> x >> y >> z;
    auto it = lower_bound(a + 1, a + 1 + n, array<int, 2>{x, -inf}) - a;
    int ans = 0;
    for (int i = it; i <= n; i++) {
      if (a[i][0] + a[i][1] >= z && a[i][1] >= y) {
        ans++;
      }
    }
    cout << ans << '\n';
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  // cin >> t;
  for (int tc = 1; tc <= t; tc++)
    run(tc);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...