Submission #4034582


Source Code Expand

n, k = map(int, input().split())
white = [[0 for _ in range(k+1)] for _ in range(2*k+1)]

for _ in range(n):
	x, y, c = input().split()
	x, y = (int(x) - 1) % (2*k), (int(y) - 1) % k
	if c == "B":
		x = (x-k) % (2*k)

	if x < k:
		white[0][0] += 1
		white[x][0] += -1
		white[x+k][0] += -1
		white[2*k][0] += 1
		white[0][y] += -1
		white[x][y] += 2
		white[x+k][y] += -2
		white[2*k][y] += 1
		white[x][k] += -1
		white[x+k][k] += 1

	else:
		white[x-k][0] += 1
		white[x][0] += -1
		white[0][y] += 1
		white[x-k][y] += -2
		white[x][y] += 2
		white[2*k][y] += -1
		white[0][k] += -1
		white[x-k][k] += 1
		white[x][k] += -1
		white[2*k][k] += 1

#print(white)

for i in range(2*k+1):
	for j in range(k):
		white[i][j+1] += white[i][j]

for j in range(k+1):
	for i in range(2*k):
		white[i+1][j] += white[i][j]

#print(white)

ans = 0
for i in range(2*k):
	for j in range(k):
		ans = max(ans, white[i][j])

print(ans)

Submission Info

Submission Time
Task D - Checker
User anagohirame
Language PyPy3 (2.4.0)
Score 0
Code Size 968 Byte
Status WA
Exec Time 798 ms
Memory 69724 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
WA × 1
AC × 17
WA × 14
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt
Case Name Status Exec Time Memory
0_000.txt AC 170 ms 38256 KB
0_001.txt AC 331 ms 59868 KB
0_002.txt WA 177 ms 38256 KB
1_003.txt AC 325 ms 59612 KB
1_004.txt AC 175 ms 38256 KB
1_005.txt AC 171 ms 38256 KB
1_006.txt AC 177 ms 38256 KB
1_007.txt AC 185 ms 39408 KB
1_008.txt AC 326 ms 59484 KB
1_009.txt WA 217 ms 38768 KB
1_010.txt WA 210 ms 38768 KB
1_011.txt WA 211 ms 38768 KB
1_012.txt WA 224 ms 39920 KB
1_013.txt AC 363 ms 60124 KB
1_014.txt WA 611 ms 48872 KB
1_015.txt WA 634 ms 49384 KB
1_016.txt WA 619 ms 48872 KB
1_017.txt WA 633 ms 50136 KB
1_018.txt WA 798 ms 69724 KB
1_019.txt AC 294 ms 46808 KB
1_020.txt AC 297 ms 46808 KB
1_021.txt AC 294 ms 46808 KB
1_022.txt AC 294 ms 46808 KB
1_023.txt AC 298 ms 47320 KB
1_024.txt AC 301 ms 47320 KB
1_025.txt WA 605 ms 49256 KB
1_026.txt WA 746 ms 69596 KB
1_027.txt WA 572 ms 47208 KB
1_028.txt WA 715 ms 67036 KB
1_029.txt AC 607 ms 48856 KB
1_030.txt AC 769 ms 69084 KB