Submission #65014820


Source Code Expand

Copy
def li():
return list(map(int, input().split()))
n,m=li()
cnt=[0]*n
ans=(m*(m-1))//2
for _ in range(m):
cnt[sum(li())%n]+=1
for i in range(n):
c=cnt[i]
ans-=(c*c-c)//2
print(ans)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def li():
    return list(map(int, input().split()))


n,m=li()
cnt=[0]*n
ans=(m*(m-1))//2
for _ in range(m):
    cnt[sum(li())%n]+=1
for i in range(n):
    c=cnt[i]
    ans-=(c*c-c)//2
print(ans)

Submission Info

Submission Time
Task D - Line Crossing
User juntenbanana
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 208 Byte
Status AC
Exec Time 226 ms
Memory 91288 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 34
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 60 ms 76432 KB
00_sample_01.txt AC 60 ms 76456 KB
01_test_00.txt AC 82 ms 82440 KB
01_test_01.txt AC 106 ms 83344 KB
01_test_02.txt AC 85 ms 83004 KB
01_test_03.txt AC 111 ms 82960 KB
01_test_04.txt AC 83 ms 82308 KB
01_test_05.txt AC 123 ms 89556 KB
01_test_06.txt AC 223 ms 90292 KB
01_test_07.txt AC 215 ms 85684 KB
01_test_08.txt AC 72 ms 81816 KB
01_test_09.txt AC 107 ms 87604 KB
01_test_10.txt AC 222 ms 88840 KB
01_test_11.txt AC 129 ms 88688 KB
01_test_12.txt AC 89 ms 89736 KB
01_test_13.txt AC 212 ms 91244 KB
01_test_14.txt AC 226 ms 91288 KB
01_test_15.txt AC 151 ms 91136 KB
01_test_16.txt AC 68 ms 88548 KB
01_test_17.txt AC 200 ms 90892 KB
01_test_18.txt AC 123 ms 88524 KB
01_test_19.txt AC 125 ms 86756 KB
01_test_20.txt AC 151 ms 84540 KB
01_test_21.txt AC 161 ms 90680 KB
01_test_22.txt AC 148 ms 90876 KB
01_test_23.txt AC 142 ms 85984 KB
01_test_24.txt AC 94 ms 90100 KB
01_test_25.txt AC 153 ms 86524 KB
01_test_26.txt AC 97 ms 91032 KB
01_test_27.txt AC 165 ms 90856 KB
01_test_28.txt AC 59 ms 76300 KB
01_test_29.txt AC 59 ms 76572 KB
01_test_30.txt AC 60 ms 76412 KB
01_test_31.txt AC 186 ms 83264 KB


2025-04-26 (Sat)
20:48:45 +09:00