# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079516 |
2024-08-28T16:17:58 Z |
Staheos |
City (BOI06_city) |
C++14 |
|
652 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 < 50000; 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 |
3 ms |
2508 KB |
Output is correct |
2 |
Incorrect |
12 ms |
1492 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
984 KB |
Output isn't correct |
4 |
Runtime error |
626 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Correct |
5 ms |
984 KB |
Output is correct |
6 |
Incorrect |
2 ms |
984 KB |
Output isn't correct |
7 |
Runtime error |
608 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
644 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
652 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Correct |
34 ms |
16828 KB |
Output is correct |