# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079525 |
2024-08-28T16:22:04 Z |
Staheos |
City (BOI06_city) |
C++14 |
|
645 ms |
524288 KB |
#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 |
1 |
Correct |
5 ms |
4804 KB |
Output is correct |
2 |
Incorrect |
17 ms |
2512 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
1492 KB |
Output isn't correct |
4 |
Runtime error |
612 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Correct |
5 ms |
1580 KB |
Output is correct |
6 |
Incorrect |
2 ms |
1492 KB |
Output isn't correct |
7 |
Runtime error |
618 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
615 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
645 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Correct |
78 ms |
33196 KB |
Output is correct |