| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 169411 | AngusRitossa | New Home (APIO18_new_home) | C++14 | 5092 ms | 14036 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 <bits/stdc++.h>
using namespace std;
int n, k, q;
int x[300010], t[300010], a[300010], b[300010];
int closestoftype[300010];
int main()
{
scanf("%d%d%d", &n, &k, &q);
for (int i = 0; i < n; i++)
{
scanf("%d%d%d%d", &x[i], &t[i], &a[i], &b[i]);
}
for (int i = 0; i < q; i++)
{
int l, y;
scanf("%d%d", &l, &y);
fill_n(closestoftype, k+1, 1e9);
for (int j = 0; j < n; j++)
{
if (a[j] <= y && y <= b[j])
{
closestoftype[t[j]] = min(closestoftype[t[j]], abs(l-x[j]));
}
}
int ans = 0;
for (int i = 1; i <= k; i++) ans = max(ans, closestoftype[i]);
if (ans == 1e9) printf("-1\n");
else printf("%d\n", ans);
}
}
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... | ||||
