結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,956 KB
testcase_01 WA -
testcase_02 AC 30 ms
9,848 KB
testcase_03 AC 30 ms
9,852 KB
testcase_04 AC 30 ms
9,740 KB
testcase_05 AC 30 ms
9,852 KB
testcase_06 AC 30 ms
9,848 KB
testcase_07 AC 29 ms
9,776 KB
testcase_08 AC 30 ms
9,916 KB
testcase_09 WA -
testcase_10 AC 30 ms
9,744 KB
testcase_11 AC 30 ms
9,932 KB
testcase_12 AC 29 ms
9,800 KB
testcase_13 AC 29 ms
9,840 KB
testcase_14 AC 29 ms
9,804 KB
testcase_15 AC 30 ms
9,804 KB
testcase_16 AC 30 ms
9,696 KB
testcase_17 AC 31 ms
9,808 KB
testcase_18 AC 30 ms
9,800 KB
testcase_19 AC 29 ms
9,648 KB
testcase_20 AC 30 ms
9,804 KB
testcase_21 AC 30 ms
9,648 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 31 ms
10,024 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 30 ms
9,972 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(b):
    b = b[:]
    if not b:
        return b
    n = len(b)
    m = len(b[0])
    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(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(a)) == len(get_base(tmp))

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