이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
const int N = 100'010;
int a[N], b[N];
int ans[N];
int x[N], y[N], z[N];
const int S = 4096;
int n, q;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
cin >> n >> q;
Loop (i,0,n)
cin >> a[i] >> b[i];
Loop (i,0,q)
cin >> x[i] >> y[i] >> z[i];
for (int l = 0; l < n; l += S) {
int r = min(l+S, n);
Loop (i,0,q) {
int x=::x[i],y=::y[i],z=::z[i];
int ans = 0;
Loop (i,l,r) {
int t1 = -(a[i]>=x);
int t2 = -(b[i]>=y);
int t3 = -(a[i]+b[i]>=z);
ans -= t1 & t2 & t3;
}
::ans[i] += ans;
}
}
Loop (i,0,q)
cout << ans[i] << '\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |