Submission #16139003


Source Code Expand

Copy
import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8, i8, i8[:]), cache=True)
def main(H, W, XY):
    U = 300_010
    row = np.zeros(U, np.int64)
    col = np.zeros(U, np.int64)
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        row[x] += 1
        col[y] += 1
    row_max = row.max()
    col_max = col.max()
    choice = np.sum(row == row_max) * np.sum(col == col_max)
    for i in range(0, len(XY), 2):
        x, y = XY[i:i + 2] - 1
        if row[x] == row_max and col[y] == col_max:
            choice -= 1
    x = row_max + col_max
    return x if choice else x - 1

H, W, M = map(int, readline().split())
XY = np.array(read().split(), np.int64)

print(main(H, W, XY))

Submission Info

Submission Time
Task E - Bomber
User maspy
Language Python (3.8.2)
Score 500
Code Size 874 Byte
Status
Exec Time 638 ms
Memory 148388 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
× 3
× 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 493 ms 111064 KB
00-Sample-001 492 ms 111108 KB
00-Sample-002 478 ms 111156 KB
01-Handmade-000 486 ms 111864 KB
01-Handmade-001 632 ms 148232 KB
01-Handmade-002 538 ms 119176 KB
01-Handmade-003 615 ms 132620 KB
01-Handmade-004 480 ms 111076 KB
01-Handmade-005 623 ms 147660 KB
01-Handmade-006 617 ms 146108 KB
01-Handmade-007 616 ms 146068 KB
01-Handmade-008 623 ms 147820 KB
02-SmallRandom-000 483 ms 111036 KB
02-SmallRandom-001 480 ms 110684 KB
02-SmallRandom-002 490 ms 111712 KB
02-SmallRandom-003 490 ms 111372 KB
02-SmallRandom-004 480 ms 110600 KB
03-LargeRandom-000 631 ms 142616 KB
03-LargeRandom-001 613 ms 139436 KB
03-LargeRandom-002 605 ms 138096 KB
03-LargeRandom-003 630 ms 141272 KB
03-LargeRandom-004 600 ms 137172 KB
03-LargeRandom-005 593 ms 136052 KB
03-LargeRandom-006 626 ms 146640 KB
03-LargeRandom-007 614 ms 141348 KB
03-LargeRandom-008 623 ms 142532 KB
03-LargeRandom-009 599 ms 137184 KB
03-LargeRandom-010 613 ms 139436 KB
03-LargeRandom-011 631 ms 147520 KB
03-LargeRandom-012 601 ms 137676 KB
03-LargeRandom-013 629 ms 148072 KB
03-LargeRandom-014 599 ms 135512 KB
03-LargeRandom-015 613 ms 140336 KB
03-LargeRandom-016 612 ms 139456 KB
03-LargeRandom-017 627 ms 146984 KB
03-LargeRandom-018 630 ms 147008 KB
03-LargeRandom-019 607 ms 139572 KB
03-LargeRandom-020 631 ms 147468 KB
03-LargeRandom-021 598 ms 137588 KB
03-LargeRandom-022 599 ms 137012 KB
03-LargeRandom-023 588 ms 135408 KB
03-LargeRandom-024 616 ms 142224 KB
03-LargeRandom-025 608 ms 139232 KB
03-LargeRandom-026 623 ms 146280 KB
03-LargeRandom-027 597 ms 135240 KB
03-LargeRandom-028 607 ms 139560 KB
03-LargeRandom-029 598 ms 135652 KB
03-LargeRandom-030 602 ms 136324 KB
03-LargeRandom-031 589 ms 136616 KB
03-LargeRandom-032 624 ms 142360 KB
03-LargeRandom-033 627 ms 146544 KB
03-LargeRandom-034 607 ms 138512 KB
03-LargeRandom-035 620 ms 141952 KB
03-LargeRandom-036 619 ms 141268 KB
03-LargeRandom-037 632 ms 146704 KB
03-LargeRandom-038 596 ms 135216 KB
03-LargeRandom-039 611 ms 140000 KB
03-LargeRandom-040 596 ms 134984 KB
03-LargeRandom-041 608 ms 138688 KB
03-LargeRandom-042 601 ms 136408 KB
03-LargeRandom-043 600 ms 136088 KB
03-LargeRandom-044 589 ms 134888 KB
03-LargeRandom-045 619 ms 140900 KB
03-LargeRandom-046 592 ms 135628 KB
03-LargeRandom-047 625 ms 146408 KB
03-LargeRandom-048 602 ms 137608 KB
03-LargeRandom-049 596 ms 136896 KB
04-H2W3-000 479 ms 111064 KB
04-H2W3-001 474 ms 111196 KB
04-H2W3-002 493 ms 111864 KB
04-H2W3-003 480 ms 111072 KB
04-H2W3-004 494 ms 111208 KB
04-H2W3-005 484 ms 111044 KB
04-H2W3-006 485 ms 111044 KB
04-H2W3-007 488 ms 111384 KB
04-H2W3-008 485 ms 110644 KB
04-H2W3-009 486 ms 111936 KB
04-H2W3-010 485 ms 111800 KB
04-H2W3-011 485 ms 111844 KB
04-H2W3-012 498 ms 111196 KB
04-H2W3-013 476 ms 111028 KB
04-H2W3-014 495 ms 111024 KB
04-H2W3-015 484 ms 111756 KB
04-H2W3-016 487 ms 111800 KB
04-H2W3-017 478 ms 111884 KB
04-H2W3-018 493 ms 111748 KB
04-H2W3-019 488 ms 110544 KB
04-H2W3-020 483 ms 111932 KB
04-H2W3-021 477 ms 111092 KB
04-H2W3-022 491 ms 111788 KB
04-H2W3-023 482 ms 111080 KB
04-H2W3-024 491 ms 111748 KB
04-H2W3-025 489 ms 111752 KB
04-H2W3-026 476 ms 111356 KB
04-H2W3-027 488 ms 111372 KB
04-H2W3-028 494 ms 111084 KB
04-H2W3-029 488 ms 111176 KB
04-H2W3-030 488 ms 111360 KB
04-H2W3-031 494 ms 111920 KB
04-H2W3-032 489 ms 111188 KB
04-H2W3-033 485 ms 111876 KB
04-H2W3-034 482 ms 110592 KB
06-Killer-000-0 629 ms 147672 KB
06-Killer-000-1 629 ms 148272 KB
06-Killer-000-2 630 ms 148288 KB
06-Killer-000-3 630 ms 147832 KB
06-Killer-001-0 628 ms 147676 KB
06-Killer-001-1 635 ms 148336 KB
06-Killer-001-2 624 ms 147824 KB
06-Killer-001-3 629 ms 147568 KB
06-Killer-002-0 637 ms 147460 KB
06-Killer-002-1 630 ms 147784 KB
06-Killer-002-2 637 ms 147764 KB
06-Killer-002-3 637 ms 147452 KB
06-Killer-003-0 638 ms 148376 KB
06-Killer-003-1 630 ms 147588 KB
06-Killer-003-2 636 ms 147840 KB
06-Killer-003-3 631 ms 148388 KB
06-Killer-004-0 613 ms 145808 KB
06-Killer-004-1 626 ms 145244 KB
06-Killer-004-2 613 ms 145604 KB
06-Killer-004-3 623 ms 145732 KB
06-Killer-005-0 603 ms 131988 KB
06-Killer-005-1 616 ms 132752 KB
06-Killer-005-2 599 ms 132252 KB
06-Killer-005-3 607 ms 132860 KB
06-Killer-006-0 613 ms 132660 KB
06-Killer-006-1 608 ms 131476 KB
06-Killer-006-2 601 ms 132188 KB
06-Killer-006-3 615 ms 132656 KB