Submission #19423066


Source Code Expand

Copy
import sys
readline = sys.stdin.readline

N = int(readline())
G = [list(readline().split()) for _ in range(N)]
for i in range(N):
    G[i][i] = '1'
def sqmat(G):
    A = [int(''.join(G[i][j] for j in range(N)), 2) for i in range(N)]
    B = [int(''.join(G[j][i] for j in range(N)), 2) for i in range(N)]
    C = [['1' if A[i]&B[j] else '0' for j in range(N)] for i in range(N)]
    return C

for _ in range(N.bit_length()):
    G = sqmat(G)


G = [list(map(int, g)) for g in G]
ans = 0
for i in range(N):
    for j in range(i+1):
        res = 0
        for k in range(N):
            if G[i][k]|G[j][k]:
                res += 1
        ans = max(ans, res)

print(ans)

Submission Info

Submission Time
Task R - グラフ
User Tallfall
Language PyPy3 (7.3.0)
Score 0
Code Size 696 Byte
Status WA
Exec Time 356 ms
Memory 80820 KB

Judge Result

Set Name All
Score / Max Score 0 / 7
Status
AC × 3
WA × 19
Set Name Test Cases
All 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 90, 91
Case Name Status Exec Time Memory
00 WA 287 ms 80292 KB
01 WA 276 ms 80300 KB
02 WA 279 ms 80424 KB
03 WA 294 ms 80756 KB
04 WA 335 ms 80408 KB
05 WA 324 ms 80328 KB
06 WA 304 ms 80636 KB
07 WA 293 ms 80548 KB
08 WA 292 ms 80512 KB
09 WA 295 ms 80408 KB
10 AC 275 ms 80292 KB
11 WA 287 ms 80820 KB
12 WA 316 ms 80272 KB
13 WA 331 ms 80508 KB
14 WA 356 ms 80756 KB
15 WA 351 ms 80444 KB
16 WA 348 ms 80564 KB
17 WA 328 ms 80556 KB
18 WA 342 ms 80280 KB
19 WA 334 ms 80572 KB
90 AC 54 ms 61940 KB
91 AC 57 ms 61936 KB