Submission #59171223
Source Code Expand
Copy
def add(N: int, C: set, a: int, b: int):if (1 <= a <= N) and (1 <= b <= N):C |= {(a, b)}return CN, M = map(int, input().split())attacked = set()for _ in range(M):a, b = map(int, input().split())attacked |= {(a, b)}attacked = add(N, attacked, a+1, b+2)attacked = add(N, attacked, a+1, b-2)attacked = add(N, attacked, a-1, b+2)attacked = add(N, attacked, a-1, b-2)attacked = add(N, attacked, a+2, b+1)attacked = add(N, attacked, a+2, b-1)attacked = add(N, attacked, a-2, b+1)attacked = add(N, attacked, a-2, b-1)
def add(N: int, C: set, a: int, b: int): if (1 <= a <= N) and (1 <= b <= N): C |= {(a, b)} return C N, M = map(int, input().split()) attacked = set() for _ in range(M): a, b = map(int, input().split()) attacked |= {(a, b)} attacked = add(N, attacked, a+1, b+2) attacked = add(N, attacked, a+1, b-2) attacked = add(N, attacked, a-1, b+2) attacked = add(N, attacked, a-1, b-2) attacked = add(N, attacked, a+2, b+1) attacked = add(N, attacked, a+2, b-1) attacked = add(N, attacked, a-2, b+1) attacked = add(N, attacked, a-2, b-1) print(N ** 2 - len(attacked))
Submission Info
Submission Time | |
---|---|
Task | C - Avoid Knight Attack |
User | Verniy73 |
Language | Python (CPython 3.11.4) |
Score | 300 |
Code Size | 613 Byte |
Status | AC |
Exec Time | 1545 ms |
Memory | 300340 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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_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, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 10 ms | 8736 KB |
00_sample_01.txt | AC | 10 ms | 8792 KB |
00_sample_02.txt | AC | 10 ms | 8808 KB |
01_random_03.txt | AC | 1041 ms | 35364 KB |
01_random_04.txt | AC | 1361 ms | 136256 KB |
01_random_05.txt | AC | 1543 ms | 299736 KB |
01_random_06.txt | AC | 1530 ms | 300308 KB |
01_random_07.txt | AC | 1525 ms | 300340 KB |
01_random_08.txt | AC | 1545 ms | 300332 KB |
01_random_09.txt | AC | 205 ms | 15868 KB |
01_random_10.txt | AC | 1021 ms | 81072 KB |
01_random_11.txt | AC | 763 ms | 156484 KB |
01_random_12.txt | AC | 99 ms | 29496 KB |
01_random_13.txt | AC | 1183 ms | 265260 KB |
01_random_14.txt | AC | 162 ms | 44628 KB |
01_random_15.txt | AC | 10 ms | 8800 KB |
01_random_16.txt | AC | 9 ms | 8836 KB |
01_random_17.txt | AC | 10 ms | 8692 KB |
01_random_18.txt | AC | 10 ms | 8864 KB |
01_random_19.txt | AC | 10 ms | 8752 KB |
01_random_20.txt | AC | 10 ms | 8784 KB |
01_random_21.txt | AC | 10 ms | 8824 KB |
01_random_22.txt | AC | 10 ms | 8748 KB |
01_random_23.txt | AC | 1068 ms | 35320 KB |
01_random_24.txt | AC | 1377 ms | 126892 KB |
01_random_25.txt | AC | 1409 ms | 170064 KB |
01_random_26.txt | AC | 1401 ms | 170396 KB |
01_random_27.txt | AC | 1416 ms | 170396 KB |
01_random_28.txt | AC | 1417 ms | 170376 KB |
01_random_29.txt | AC | 16 ms | 9696 KB |
01_random_30.txt | AC | 209 ms | 15784 KB |
01_random_31.txt | AC | 998 ms | 149824 KB |
01_random_32.txt | AC | 54 ms | 17024 KB |
01_random_33.txt | AC | 10 ms | 9000 KB |
01_random_34.txt | AC | 822 ms | 136904 KB |