Submission #19422994


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 i in range(N)), 2) for j in range(N)]
    B = [int(''.join(G[i][j] for j in range(N)), 2) for i in range(N)]
    C = [['1' if A[i]&B[j] else '0' for i in range(N)] for j 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):
        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 694 Byte
Status WA
Exec Time 363 ms
Memory 80592 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 316 ms 80200 KB
01 WA 278 ms 80220 KB
02 WA 288 ms 80088 KB
03 WA 295 ms 79928 KB
04 WA 317 ms 80220 KB
05 WA 324 ms 80308 KB
06 WA 302 ms 80396 KB
07 WA 297 ms 80420 KB
08 WA 307 ms 80292 KB
09 WA 301 ms 80208 KB
10 AC 289 ms 80260 KB
11 WA 294 ms 80392 KB
12 WA 323 ms 80308 KB
13 WA 340 ms 80260 KB
14 WA 363 ms 80088 KB
15 WA 351 ms 80240 KB
16 WA 336 ms 80592 KB
17 WA 343 ms 80356 KB
18 WA 329 ms 80392 KB
19 WA 333 ms 80220 KB
90 AC 58 ms 61952 KB
91 AC 53 ms 61984 KB