Submission #59858

#TimeUsernameProblemLanguageResultExecution timeMemory
59858Eae02New Home (APIO18_new_home)C++14
0 / 100
5064 ms26288 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...