Submission #4034598


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) % (2*k)
	if (c == "B") ^ (y >= k):
		x = (x-k) % (2*k)
		
	y %= 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 998 Byte
Status WA
Exec Time 853 ms
Memory 74076 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 25
WA × 6
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 163 ms 38256 KB
0_001.txt AC 314 ms 59612 KB
0_002.txt AC 164 ms 38256 KB
1_003.txt AC 301 ms 59612 KB
1_004.txt AC 166 ms 38256 KB
1_005.txt AC 166 ms 38256 KB
1_006.txt AC 174 ms 38256 KB
1_007.txt AC 186 ms 39408 KB
1_008.txt AC 306 ms 59612 KB
1_009.txt WA 203 ms 38768 KB
1_010.txt WA 204 ms 38768 KB
1_011.txt AC 204 ms 38768 KB
1_012.txt AC 215 ms 39920 KB
1_013.txt AC 342 ms 60124 KB
1_014.txt WA 660 ms 53848 KB
1_015.txt AC 653 ms 53336 KB
1_016.txt AC 645 ms 53224 KB
1_017.txt WA 681 ms 54616 KB
1_018.txt AC 853 ms 74076 KB
1_019.txt WA 287 ms 46936 KB
1_020.txt WA 290 ms 46936 KB
1_021.txt AC 287 ms 46808 KB
1_022.txt AC 290 ms 46808 KB
1_023.txt AC 296 ms 47612 KB
1_024.txt AC 297 ms 47576 KB
1_025.txt AC 666 ms 53864 KB
1_026.txt AC 785 ms 73948 KB
1_027.txt AC 593 ms 49640 KB
1_028.txt AC 759 ms 69340 KB
1_029.txt AC 587 ms 49000 KB
1_030.txt AC 730 ms 69340 KB