Contest Duration: - (local time) (100 minutes) Back to Home

Submission #16180005

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}

int H, W, M;
set<i_i> st;

void input() {
cin >> H >> W >> M;
for(int i = 0; i < M; i++) {
int a, b;
cin >> a >> b;
st.insert({a, b});
}
}

void solve() {
map<int, int> mph, mpw;
int hmaxval = 0;
int wmaxval = 0;
vector<int> hmax, wmax;
for(auto tmp : st) {
chmax(hmaxval, ++mph[tmp.first]);
chmax(wmaxval, ++mpw[tmp.second]);
}
for(auto tmp : mph) {
if(hmaxval == tmp.second) hmax.push_back(tmp.first);
}
for(auto tmp : mpw) {
if(wmaxval == tmp.second) wmax.push_back(tmp.first);
}
int ANS = hmaxval + wmaxval - 1;
for(auto h : hmax) {
for(auto w : wmax) {
if(st.find({h, w}) == st.end()) {
ANS++;
cout << ANS << endl;
return;
}
}
}
cout << ANS << endl;
}

int main() {
input();
solve();
return 0;
}```

#### Submission Info

Submission Time 2020-08-23 19:36:04+0900 E - Bomber kort0n C++ (GCC 9.2.1) 500 1182 Byte AC 617 ms 49572 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
 AC × 3
 AC × 130
Set Name Test Cases
Sample 00-Sample-000, 00-Sample-001, 00-Sample-002
All 00-Sample-000, 00-Sample-001, 00-Sample-002, 01-Handmade-000, 01-Handmade-001, 01-Handmade-002, 01-Handmade-003, 01-Handmade-004, 01-Handmade-005, 01-Handmade-006, 01-Handmade-007, 01-Handmade-008, 02-SmallRandom-000, 02-SmallRandom-001, 02-SmallRandom-002, 02-SmallRandom-003, 02-SmallRandom-004, 03-LargeRandom-000, 03-LargeRandom-001, 03-LargeRandom-002, 03-LargeRandom-003, 03-LargeRandom-004, 03-LargeRandom-005, 03-LargeRandom-006, 03-LargeRandom-007, 03-LargeRandom-008, 03-LargeRandom-009, 03-LargeRandom-010, 03-LargeRandom-011, 03-LargeRandom-012, 03-LargeRandom-013, 03-LargeRandom-014, 03-LargeRandom-015, 03-LargeRandom-016, 03-LargeRandom-017, 03-LargeRandom-018, 03-LargeRandom-019, 03-LargeRandom-020, 03-LargeRandom-021, 03-LargeRandom-022, 03-LargeRandom-023, 03-LargeRandom-024, 03-LargeRandom-025, 03-LargeRandom-026, 03-LargeRandom-027, 03-LargeRandom-028, 03-LargeRandom-029, 03-LargeRandom-030, 03-LargeRandom-031, 03-LargeRandom-032, 03-LargeRandom-033, 03-LargeRandom-034, 03-LargeRandom-035, 03-LargeRandom-036, 03-LargeRandom-037, 03-LargeRandom-038, 03-LargeRandom-039, 03-LargeRandom-040, 03-LargeRandom-041, 03-LargeRandom-042, 03-LargeRandom-043, 03-LargeRandom-044, 03-LargeRandom-045, 03-LargeRandom-046, 03-LargeRandom-047, 03-LargeRandom-048, 03-LargeRandom-049, 04-H2W3-000, 04-H2W3-001, 04-H2W3-002, 04-H2W3-003, 04-H2W3-004, 04-H2W3-005, 04-H2W3-006, 04-H2W3-007, 04-H2W3-008, 04-H2W3-009, 04-H2W3-010, 04-H2W3-011, 04-H2W3-012, 04-H2W3-013, 04-H2W3-014, 04-H2W3-015, 04-H2W3-016, 04-H2W3-017, 04-H2W3-018, 04-H2W3-019, 04-H2W3-020, 04-H2W3-021, 04-H2W3-022, 04-H2W3-023, 04-H2W3-024, 04-H2W3-025, 04-H2W3-026, 04-H2W3-027, 04-H2W3-028, 04-H2W3-029, 04-H2W3-030, 04-H2W3-031, 04-H2W3-032, 04-H2W3-033, 04-H2W3-034, 06-Killer-000-0, 06-Killer-000-1, 06-Killer-000-2, 06-Killer-000-3, 06-Killer-001-0, 06-Killer-001-1, 06-Killer-001-2, 06-Killer-001-3, 06-Killer-002-0, 06-Killer-002-1, 06-Killer-002-2, 06-Killer-002-3, 06-Killer-003-0, 06-Killer-003-1, 06-Killer-003-2, 06-Killer-003-3, 06-Killer-004-0, 06-Killer-004-1, 06-Killer-004-2, 06-Killer-004-3, 06-Killer-005-0, 06-Killer-005-1, 06-Killer-005-2, 06-Killer-005-3, 06-Killer-006-0, 06-Killer-006-1, 06-Killer-006-2, 06-Killer-006-3
Case Name Status Exec Time Memory
00-Sample-000 AC 7 ms 3420 KB
00-Sample-001 AC 1 ms 3608 KB
00-Sample-002 AC 2 ms 3424 KB
01-Handmade-000 AC 2 ms 3508 KB
01-Handmade-001 AC 479 ms 35304 KB
01-Handmade-002 AC 158 ms 18196 KB
01-Handmade-003 AC 334 ms 28400 KB
01-Handmade-004 AC 2 ms 3580 KB
01-Handmade-005 AC 345 ms 17520 KB
01-Handmade-006 AC 314 ms 17732 KB
01-Handmade-007 AC 275 ms 17540 KB
01-Handmade-008 AC 298 ms 17532 KB
02-SmallRandom-000 AC 4 ms 3512 KB
02-SmallRandom-001 AC 2 ms 3600 KB
02-SmallRandom-002 AC 7 ms 3712 KB
02-SmallRandom-003 AC 12 ms 3788 KB
02-SmallRandom-004 AC 2 ms 3500 KB
03-LargeRandom-000 AC 438 ms 32344 KB
03-LargeRandom-001 AC 383 ms 30208 KB
03-LargeRandom-002 AC 389 ms 29864 KB
03-LargeRandom-003 AC 430 ms 32316 KB
03-LargeRandom-004 AC 367 ms 29552 KB
03-LargeRandom-005 AC 343 ms 28232 KB
03-LargeRandom-006 AC 435 ms 31516 KB
03-LargeRandom-007 AC 410 ms 31256 KB
03-LargeRandom-008 AC 430 ms 31948 KB
03-LargeRandom-009 AC 373 ms 29292 KB
03-LargeRandom-010 AC 408 ms 31656 KB
03-LargeRandom-011 AC 480 ms 34636 KB
03-LargeRandom-012 AC 353 ms 28808 KB
03-LargeRandom-013 AC 467 ms 33916 KB
03-LargeRandom-014 AC 347 ms 29120 KB
03-LargeRandom-015 AC 400 ms 30968 KB
03-LargeRandom-016 AC 401 ms 31284 KB
03-LargeRandom-017 AC 443 ms 33208 KB
03-LargeRandom-018 AC 453 ms 33796 KB
03-LargeRandom-019 AC 390 ms 31484 KB
03-LargeRandom-020 AC 460 ms 33896 KB
03-LargeRandom-021 AC 372 ms 29816 KB
03-LargeRandom-022 AC 371 ms 29432 KB
03-LargeRandom-023 AC 331 ms 27960 KB
03-LargeRandom-024 AC 427 ms 31480 KB
03-LargeRandom-025 AC 384 ms 30484 KB
03-LargeRandom-026 AC 443 ms 32372 KB
03-LargeRandom-027 AC 340 ms 27616 KB
03-LargeRandom-028 AC 407 ms 32252 KB
03-LargeRandom-029 AC 347 ms 28624 KB
03-LargeRandom-030 AC 361 ms 29100 KB
03-LargeRandom-031 AC 364 ms 28700 KB
03-LargeRandom-032 AC 447 ms 32396 KB
03-LargeRandom-033 AC 450 ms 33048 KB
03-LargeRandom-034 AC 391 ms 30996 KB
03-LargeRandom-035 AC 434 ms 31896 KB
03-LargeRandom-036 AC 422 ms 32532 KB
03-LargeRandom-037 AC 458 ms 33584 KB
03-LargeRandom-038 AC 348 ms 27680 KB
03-LargeRandom-039 AC 427 ms 32520 KB
03-LargeRandom-040 AC 353 ms 28148 KB
03-LargeRandom-041 AC 369 ms 29688 KB
03-LargeRandom-042 AC 361 ms 29016 KB
03-LargeRandom-043 AC 366 ms 29072 KB
03-LargeRandom-044 AC 338 ms 28768 KB
03-LargeRandom-045 AC 403 ms 31316 KB
03-LargeRandom-046 AC 333 ms 28172 KB
03-LargeRandom-047 AC 442 ms 33412 KB
03-LargeRandom-048 AC 351 ms 28824 KB
03-LargeRandom-049 AC 350 ms 28700 KB
04-H2W3-000 AC 2 ms 3612 KB
04-H2W3-001 AC 3 ms 3476 KB
04-H2W3-002 AC 2 ms 3536 KB
04-H2W3-003 AC 1 ms 3420 KB
04-H2W3-004 AC 2 ms 3416 KB
04-H2W3-005 AC 3 ms 3528 KB
04-H2W3-006 AC 1 ms 3512 KB
04-H2W3-007 AC 3 ms 3476 KB
04-H2W3-008 AC 2 ms 3532 KB
04-H2W3-009 AC 3 ms 3404 KB
04-H2W3-010 AC 6 ms 3612 KB
04-H2W3-011 AC 2 ms 3588 KB
04-H2W3-012 AC 3 ms 3576 KB
04-H2W3-013 AC 2 ms 3480 KB
04-H2W3-014 AC 3 ms 3480 KB
04-H2W3-015 AC 2 ms 3396 KB
04-H2W3-016 AC 2 ms 3400 KB
04-H2W3-017 AC 2 ms 3392 KB
04-H2W3-018 AC 2 ms 3476 KB
04-H2W3-019 AC 2 ms 3532 KB
04-H2W3-020 AC 2 ms 3584 KB
04-H2W3-021 AC 2 ms 3460 KB
04-H2W3-022 AC 2 ms 3528 KB
04-H2W3-023 AC 3 ms 3420 KB
04-H2W3-024 AC 3 ms 3580 KB
04-H2W3-025 AC 1 ms 3476 KB
04-H2W3-026 AC 2 ms 3472 KB
04-H2W3-027 AC 2 ms 3532 KB
04-H2W3-028 AC 2 ms 3468 KB
04-H2W3-029 AC 2 ms 3452 KB
04-H2W3-030 AC 2 ms 3580 KB
04-H2W3-031 AC 3 ms 3448 KB
04-H2W3-032 AC 2 ms 3420 KB
04-H2W3-033 AC 2 ms 3452 KB
04-H2W3-034 AC 2 ms 3588 KB
06-Killer-000-0 AC 453 ms 45572 KB
06-Killer-000-1 AC 446 ms 45712 KB
06-Killer-000-2 AC 451 ms 45760 KB
06-Killer-000-3 AC 454 ms 45768 KB
06-Killer-001-0 AC 452 ms 45760 KB
06-Killer-001-1 AC 445 ms 45660 KB
06-Killer-001-2 AC 454 ms 45712 KB
06-Killer-001-3 AC 439 ms 45648 KB
06-Killer-002-0 AC 468 ms 31860 KB
06-Killer-002-1 AC 432 ms 31916 KB
06-Killer-002-2 AC 462 ms 31860 KB
06-Killer-002-3 AC 429 ms 31808 KB
06-Killer-003-0 AC 595 ms 49444 KB
06-Killer-003-1 AC 617 ms 49572 KB
06-Killer-003-2 AC 598 ms 49388 KB
06-Killer-003-3 AC 597 ms 49380 KB
06-Killer-004-0 AC 264 ms 17664 KB
06-Killer-004-1 AC 265 ms 17664 KB
06-Killer-004-2 AC 270 ms 17612 KB
06-Killer-004-3 AC 256 ms 17536 KB
06-Killer-005-0 AC 330 ms 22480 KB
06-Killer-005-1 AC 315 ms 22528 KB
06-Killer-005-2 AC 326 ms 22664 KB
06-Killer-005-3 AC 323 ms 22484 KB
06-Killer-006-0 AC 367 ms 33408 KB
06-Killer-006-1 AC 366 ms 33304 KB
06-Killer-006-2 AC 365 ms 33224 KB
06-Killer-006-3 AC 361 ms 33472 KB