# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1079525 | Staheos | City (BOI06_city) | C++14 | 645 ms | 524288 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 <iostream>
#include <queue>
using namespace std;
int main()
{
long long n, t, k;
cin >> n >> t >> k;
int* c = new int[k];
for (int i = 0; i < k; i++)
{
cin >> c[i];
}
auto q = priority_queue<pair<int, int>, vector<pair<int, int>>, std::greater<pair<int, int>>>();
long long s = 0;
long long l = 0;
for (int i = 0; i < 100000; i++)
{
for (int j = 0; j < k; j++)
{
// -1, bo |x| + |y| - 1
q.push(pair<int, int>(c[j] + (i + 1 - 1) * t, (i + 1) * 4));
}
}
while (l < n)
{
//cout << "DODANI: " << min(n - l, (long long)q.top().second) << ' ' << q.top().first * min(n - l, (long long)q.top().second) << '\n';
s = s + q.top().first * min(n - l, (long long)q.top().second);
l = l + min(n - l, (long long) q.top().second);
q.pop();
}
cout << s << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |