#include <bits/stdc++.h>
#define ALL(x) x.begin(),x.end()
struct Store
{
long pos;
long type;
long oYear;
long cYear;
};
int main()
{
long numStores, numTypes, numQ;
std::cin >> numStores;
std::cin >> numTypes;
std::cin >> numQ;
std::vector<Store> stores(numStores);
for (long s = 0; s < numStores; s++)
{
std::cin >> stores[s].pos;
std::cin >> stores[s].type;
std::cin >> stores[s].oYear;
std::cin >> stores[s].cYear;
stores[s].type--;
}
std::vector<long> maxDist(numTypes);
for (long i = 0; i < numQ; i++)
{
long pos, year;
std::cin >> pos;
std::cin >> year;
std::fill(ALL(maxDist), -1);
for (long s = 0; s < numStores; s++)
{
if (stores[s].cYear < year || stores[s].oYear > year)
continue;
long dist = std::abs(stores[s].pos - pos);
maxDist[stores[s].type] = std::max(maxDist[stores[s].type], dist);
}
long inconv = -1;
for (long d : maxDist)
{
if (d == -1)
{
inconv = -1;
break;
}
inconv = std::max(inconv, d);
}
std::cout << inconv << std::endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
476 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Incorrect |
2 ms |
572 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
476 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Incorrect |
2 ms |
572 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5034 ms |
19052 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5064 ms |
26288 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
476 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Incorrect |
2 ms |
572 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
476 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Incorrect |
2 ms |
572 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |