개발자 톡
연습문제 톡
CPTI
[CPTI] 타임아웃 기준을 못맞추겠어요
- 등록일
- 2025-01-24 20:11:09
- 조회수
- 305
- 작성자
- dontakeman
import sys
input = sys.stdin.readline
N, M = map(int, input().strip().split())
people = [int(input().rstrip(), 2) for _ in range(N)]
ans = 0
for i in range(N-1):
p1 = people[i]
for j in range(i+1, N):
if bin(p1^people[j])[2:].count('1') < 3: ans += 1
print(ans)
3초 기준에 3.08x 초로 계속 실패하는데 어떻게 해도 실패하네요. O(N^2M) 보다 더 빠르게 못할 것 같은데.
#CPTI
#timeout