# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
595176 |
2022-07-13T12:17:21 Z |
piOOE |
Soccer (JOI17_soccer) |
C++17 |
|
1 ms |
316 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int h, w, n;
ll a, b, c;
cin >> h >> w >> a >> b >> c >> n;
vector<int> x(n), y(n);
for (int i = 0; i < n; ++i) {
cin >> x[i] >> y[i];
}
int mx = max(h, w);
for (int k = 1; k <= max(h, w); ++k) {
if (c * k > a * k + b) {
mx = k - 1;
break;
}
}
auto distance = [&](int i, int j) {
int f = abs(x[i] - x[j]), s = abs(y[i] - y[j]);
if (f < s) {
swap(f, s);
}
return s * c + (f <= mx ? f * c : f * a + b);
};
cout << distance(0, 1) << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |