# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829487 | rainboy | Curtains (NOI23_curtains) | C11 | 176 ms | 18288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#define N 2000
#define M 500000
int main() {
static char has[N][N], can[N][N];
static int ll[N], qu[N];
int n, m, q, cnt, l, r;
scanf("%d%d%d", &n, &m, &q);
while (m--) {
scanf("%d%d", &l, &r), l--, r--;
has[l][r] = 1;
}
for (r = 0; r < n; r++)
ll[r] = r + 1;
for (l = n - 1; l >= 0; l--) {
for (r = l; r < n; r++)
if (has[l][r])
ll[r] = l;
cnt = 0;
for (r = l; r < n; r++) {
qu[cnt++] = r;
while (cnt && qu[cnt - 1] >= ll[r])
cnt--;
can[l][r] = cnt == 0;
}
}
while (q--) {
scanf("%d%d", &l, &r), l--, r--;
printf(can[l][r] ? "YES\n" : "NO\n");
}
return 0;
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |