Submission #41736005


Source Code Expand

# import math, heapq, bisect, itertools, functools
# from collections import deque, Counter, defaultdict, OrderedDict

# python sample.py < input.txt

if __name__ == '__main__':
    n, m = [int(i) for i in input().split()]
    ls = []
    for _ in range(m):
        ls.append([int(i)-1 for i in input().split()])
    A = [[False] * n for _ in range(n)]
    # print(ls)
    for i in range(m):
        for j in range(n-1):
            a, b = ls[i][j], ls[i][j+1]
            A[a][b] = True
            A[b][a] = True
    # print(A)
    ans = 0
    for i in range(n):
        for j in range(n):
            if i != j and not A[i][j]:
                ans += 1
    print(ans // 2)

Submission Info

Submission Time
Task B - Discord
User shinever
Language PyPy3 (7.3.0)
Score 200
Code Size 700 Byte
Status AC
Exec Time 62 ms
Memory 67172 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 14
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 02_rnd_00.txt, 02_rnd_01.txt, 02_rnd_02.txt, 03_same_00.txt, 03_same_01.txt, 03_same_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 62 ms 61972 KiB
00_sample_01.txt AC 47 ms 61988 KiB
00_sample_02.txt AC 47 ms 61956 KiB
01_small_00.txt AC 49 ms 61960 KiB
01_small_01.txt AC 50 ms 61788 KiB
01_small_02.txt AC 51 ms 61756 KiB
01_small_03.txt AC 50 ms 62204 KiB
01_small_04.txt AC 50 ms 62052 KiB
02_rnd_00.txt AC 56 ms 67172 KiB
02_rnd_01.txt AC 53 ms 65148 KiB
02_rnd_02.txt AC 56 ms 67076 KiB
03_same_00.txt AC 50 ms 62248 KiB
03_same_01.txt AC 56 ms 66964 KiB
03_same_02.txt AC 56 ms 67068 KiB