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>
int main()
{
int numJ, numE;
std::cin >> numJ;
std::cin >> numE;
if (numJ != 1)
return 1;
int minDelay = INT32_MAX;
int maxDelay = 0;
std::vector<int> delay(numE);
for (int i = 0; i < numE; i++)
{
int n, l;
std::cin >> n;
std::cin >> l;
minDelay = std::min(l, minDelay);
maxDelay = std::max(l, maxDelay);
delay[i] = l;
}
int minCost = INT32_MAX;
for (int i = 0; i < numE; i++)
{
int cost = 0;
for (int j = 0; j < numE; j++)
{
cost += std::abs(delay[j] - delay[i]);
}
minCost = std::min(minCost, cost);
}
std::cout << minCost << std::endl;
}
# | 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... |