Submission #2869649
Source Code Expand
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul
sys.setrecursionlimit(10000)
def read_int():
return int(input())
def read_int_n():
return list(map(int, input().split()))
def read_float():
return float(input())
def read_float_n():
return list(map(float, input().split()))
def read_str():
return input()
def read_str_n():
return list(map(str, input().split()))
def error_print(*args):
print(*args, file=sys.stderr)
def mt(f):
import time
def wrap(*args, **kwargs):
s = time.time()
ret = f(*args, **kwargs)
e = time.time()
error_print(e - s, 'sec')
return ret
return wrap
@mt
def slv(N, K, XYC):
ans = []
for i in range(K):
for j in range(K):
# print(i, j)
a_w = 0
a_b = 0
for x, y, c in XYC:
x_ = ((x+j) // K) % 2
y_ = ((y+i) // K) % 2
if (x_ + y_) % 2 == 0:
if c == 'W':
a_w += 1
else:
a_b += 1
else:
if c == 'B':
a_w += 1
else:
a_b += 1
ans.append(a_w)
ans.append(a_b)
# print(ans[-2])
# print(ans[-1])
return max(ans)
def main():
N, K = read_int_n()
XYC = [read_str_n() for _ in range(N)]
XYC = list(map(lambda x: (int(x[0]), int(x[1]), x[2]), XYC))
print(slv(N, K, XYC))
if __name__ == '__main__':
main()
Submission Info
Submission Time |
|
Task |
D - Checker |
User |
patahene |
Language |
Python (3.4.3) |
Score |
0 |
Code Size |
1985 Byte |
Status |
TLE |
Exec Time |
2105 ms |
Memory |
50684 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
|
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 |
70 ms |
6860 KB |
0_001.txt |
AC |
864 ms |
21184 KB |
0_002.txt |
AC |
37 ms |
5456 KB |
1_003.txt |
AC |
635 ms |
21328 KB |
1_004.txt |
AC |
37 ms |
5456 KB |
1_005.txt |
AC |
37 ms |
5456 KB |
1_006.txt |
AC |
37 ms |
5456 KB |
1_007.txt |
AC |
43 ms |
5584 KB |
1_008.txt |
AC |
634 ms |
21184 KB |
1_009.txt |
AC |
41 ms |
5712 KB |
1_010.txt |
AC |
42 ms |
5708 KB |
1_011.txt |
AC |
51 ms |
5712 KB |
1_012.txt |
TLE |
2104 ms |
6032 KB |
1_013.txt |
TLE |
2104 ms |
6028 KB |
1_014.txt |
AC |
454 ms |
50684 KB |
1_015.txt |
AC |
565 ms |
50640 KB |
1_016.txt |
AC |
1405 ms |
50640 KB |
1_017.txt |
TLE |
2105 ms |
50640 KB |
1_018.txt |
TLE |
2105 ms |
50684 KB |
1_019.txt |
TLE |
2104 ms |
8896 KB |
1_020.txt |
TLE |
2104 ms |
8892 KB |
1_021.txt |
TLE |
2104 ms |
8896 KB |
1_022.txt |
TLE |
2104 ms |
8896 KB |
1_023.txt |
TLE |
2104 ms |
8896 KB |
1_024.txt |
TLE |
2104 ms |
8896 KB |
1_025.txt |
TLE |
2105 ms |
48992 KB |
1_026.txt |
TLE |
2105 ms |
49044 KB |
1_027.txt |
TLE |
2105 ms |
41052 KB |
1_028.txt |
TLE |
2105 ms |
41116 KB |
1_029.txt |
TLE |
2105 ms |
41120 KB |
1_030.txt |
TLE |
2105 ms |
41052 KB |