QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#552071 | #8902. Видеонаблюдение | hcywoi | 5 | 0ms | 3612kb | C++23 | 924b | 2024-09-07 20:18:06 | 2024-09-07 20:18:08 |
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int h, w, k;
std::cin >> h >> w >> k;
std::vector<int> r(k), c(k);
for (int i = 0; i < k; i ++ ) {
std::cin >> r[i] >> c[i];
}
std::sort(r.begin(), r.end());
std::sort(c.begin(), c.end());
int hcnt = 0, wcnt = 0;
int hmin = r[k - 1] - r[0] + 1, wmin = c[k - 1] - c[0] + 1;
for (int i = 1; i < k; i ++ ) {
int R = r[i - 1] + h - r[i] + 1;
if (R < hmin) {
hmin = R;
hcnt = h - r[i] + 1;
} else if (R == hmin) {
hcnt = std::min(hcnt, h - r[i] + 1);
}
}
for (int i = 1; i < k; i ++ ) {
int R = c[i - 1] + w - c[i] + 1;
if (R < wmin) {
wmin = R;
wcnt = w - c[i] + 1;
} else if (R == wmin) {
wcnt = std::min(wcnt, w - c[i] + 1);
}
}
std::cout << 1LL * hmin * wmin << " " << hcnt + wcnt << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 3548kb
input:
388 366 1 288 22
output:
1 0
result:
ok 2 number(s): "1 0"
Test #2:
score: 5
Accepted
time: 0ms
memory: 3612kb
input:
819482704 658532316 1 123698216 225317189
output:
1 0
result:
ok 2 number(s): "1 0"
Subtask #2:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3536kb
input:
487 439 2 64 8 334 266
output:
39676 328
result:
wrong answer 2nd numbers differ - expected: '72', found: '328'
Subtask #3:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
1 777 321 1 364 1 34 1 499 1 258 1 502 1 79 1 161 1 472 1 307 1 553 1 492 1 234 1 7 1 365 1 163 1 25 1 252 1 675 1 623 1 236 1 198 1 93 1 563 1 119 1 583 1 422 1 762 1 652 1 125 1 476 1 385 1 23 1 9 1 265 1 323 1 529 1 491 1 550 1 757 1 31 1 145 1 107 1 189 1 436 1 89 1 268 1 456 1 414 1 568 1 530 1...
output:
766 550
result:
wrong answer 2nd numbers differ - expected: '145', found: '550'
Subtask #4:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
48 49 15 47 14 40 40 10 40 42 26 34 34 25 26 43 14 25 34 34 46 42 46 43 16 47 16 10 14 42 40 5 34
output:
1122 24
result:
wrong answer 2nd numbers differ - expected: '10', found: '24'
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #4:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%