Submission #71692417


Source Code Expand

import sys
input = sys.stdin.read
data = input().split()

index = 0
N = int(data[index])
index += 1
M = int(data[index])
index += 1

occupied = set()
count = 0

for _ in range(M):
    r = int(data[index])
    index += 1
    c = int(data[index])
    index += 1
    
    is_valid = True
    for dr in range(2):
        for dc in range(2):
            if (r + dr, c + dc) in occupied:
                is_valid = False
                break
        if not is_valid:
            break
    
    if is_valid:
        count += 1
        for dr in range(2):
            for dc in range(2):
                occupied.add((r + dr, c + dc))

print(count)

Submission Info

Submission Time
Task C - 2x2 Placing
User a_legend_cat
Language Python (CPython 3.13.7)
Score 300
Code Size 679 Byte
Status AC
Exec Time 808 ms
Memory 173028 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 36
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 12 ms 9160 KiB
00_sample_01.txt AC 12 ms 9224 KiB
00_sample_02.txt AC 12 ms 9084 KiB
01_random_00.txt AC 57 ms 10924 KiB
01_random_01.txt AC 123 ms 14100 KiB
01_random_02.txt AC 116 ms 16188 KiB
01_random_03.txt AC 153 ms 30432 KiB
01_random_04.txt AC 154 ms 44376 KiB
01_random_05.txt AC 188 ms 35648 KiB
01_random_06.txt AC 411 ms 93704 KiB
01_random_07.txt AC 744 ms 159148 KiB
01_random_08.txt AC 428 ms 88112 KiB
01_random_09.txt AC 779 ms 165680 KiB
01_random_10.txt AC 138 ms 46500 KiB
01_random_11.txt AC 766 ms 166864 KiB
02_random2_00.txt AC 808 ms 173028 KiB
02_random2_01.txt AC 782 ms 172600 KiB
02_random2_02.txt AC 779 ms 171796 KiB
02_random2_03.txt AC 783 ms 171048 KiB
02_random2_04.txt AC 783 ms 169932 KiB
02_random2_05.txt AC 769 ms 168652 KiB
02_random2_06.txt AC 760 ms 168016 KiB
02_random2_07.txt AC 728 ms 168012 KiB
02_random2_08.txt AC 734 ms 168028 KiB
02_random2_09.txt AC 712 ms 168032 KiB
02_random2_10.txt AC 636 ms 134924 KiB
02_random2_11.txt AC 607 ms 127800 KiB
02_random2_12.txt AC 561 ms 115976 KiB
02_random2_13.txt AC 463 ms 104068 KiB
02_random2_14.txt AC 326 ms 73544 KiB
02_random2_15.txt AC 169 ms 40844 KiB
03_handmade_00.txt AC 114 ms 14112 KiB
03_handmade_01.txt AC 459 ms 100232 KiB
03_handmade_02.txt AC 525 ms 106512 KiB
03_handmade_03.txt AC 436 ms 100232 KiB
03_handmade_04.txt AC 407 ms 75392 KiB