結果

問題 No.2446 完全列
ユーザー KudeKude
提出日時 2023-08-25 23:09:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,624 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 10,052 KB
最終ジャッジ日時 2023-08-26 01:34:51
合計ジャッジ時間 2,273 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,912 KB
testcase_01 AC 30 ms
9,828 KB
testcase_02 AC 30 ms
9,692 KB
testcase_03 AC 30 ms
9,804 KB
testcase_04 AC 30 ms
9,832 KB
testcase_05 WA -
testcase_06 AC 30 ms
10,004 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 29 ms
9,796 KB
testcase_10 AC 30 ms
9,924 KB
testcase_11 AC 29 ms
9,692 KB
testcase_12 AC 29 ms
9,692 KB
testcase_13 AC 31 ms
9,792 KB
testcase_14 WA -
testcase_15 AC 31 ms
9,800 KB
testcase_16 AC 31 ms
9,912 KB
testcase_17 WA -
testcase_18 AC 30 ms
9,972 KB
testcase_19 AC 30 ms
9,800 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 31 ms
9,692 KB
testcase_23 AC 31 ms
9,916 KB
testcase_24 WA -
testcase_25 AC 30 ms
9,832 KB
testcase_26 AC 31 ms
9,692 KB
testcase_27 AC 31 ms
10,008 KB
testcase_28 AC 29 ms
10,052 KB
testcase_29 AC 30 ms
10,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from fractions import Fraction
# print(sys.stdin.buffer.read())
inp = map(int, sys.stdin.buffer.read().split())
# l, m, n = map(int, input().split())
l = next(inp)
m = next(inp)
n = next(inp)
# N->M->L
# A: M->L ... M * L
# B: N->M ... N * M
a = [[0] * l for _ in range(m)]
b = [[0] * m for _ in range(n)]
for j in range(l):
    for i in range(m):
        a[i][j] = Fraction(next(inp), 1)

for j in range(m):
    for i in range(n):
        b[i][j] = Fraction(next(inp), 1)

def get_base(n, m, b):
    b = b[:]
    i = 0
    for j in range(m):
        for i0 in range(i, n):
            if b[i0][j]:
                break
        else:
            continue
        b[i], b[i0] = b[i0], b[i]
        c = 1 / b[i][j]
        for j0 in range(j, m):
            b[i][j0] *= c
        for i0 in range(i + 1, n):
            c = b[i0][j]
            for j0 in range(j, m):
                b[i0][j0] -= b[i][j0] * c
        i += 1
    b = b[:i]
    return b

b = get_base(n, m, b)

for u in b:
    if any(sum(u[i] * a[i][j] for i in range(m)) for j in range(l)):
        print('No')
        exit()

tmp = []
for j in range(m):
    v = [Fraction(0, 1)] * m
    v[j] += 1
    for bi in b:
        for j0 in range(m):
            if bi[j0]:
                c = v[j0] / bi[j0]
                for j1 in range(j0, m):
                    v[j1] -= c * bi[j1]
                break
    if any(v):
        u = [Fraction(0, 1)] * l
        for j in range(m):
            for k in range(l):
                u[k] += v[j] * a[j][k]
        tmp.append(u)

ok = len(get_base(len(tmp), l, tmp)) == len(tmp)

print('Yes' if ok else 'No')
0