結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,016 KB
testcase_01 AC 31 ms
9,876 KB
testcase_02 AC 30 ms
9,640 KB
testcase_03 AC 30 ms
9,768 KB
testcase_04 AC 31 ms
9,740 KB
testcase_05 AC 31 ms
9,736 KB
testcase_06 AC 30 ms
9,676 KB
testcase_07 AC 30 ms
9,804 KB
testcase_08 AC 30 ms
9,776 KB
testcase_09 AC 30 ms
9,956 KB
testcase_10 AC 30 ms
9,740 KB
testcase_11 AC 30 ms
9,656 KB
testcase_12 AC 30 ms
9,636 KB
testcase_13 AC 29 ms
9,756 KB
testcase_14 AC 30 ms
9,948 KB
testcase_15 AC 30 ms
9,760 KB
testcase_16 AC 31 ms
9,948 KB
testcase_17 AC 30 ms
9,780 KB
testcase_18 AC 31 ms
9,804 KB
testcase_19 AC 30 ms
9,988 KB
testcase_20 AC 30 ms
9,768 KB
testcase_21 AC 31 ms
9,768 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 31 ms
9,648 KB
testcase_25 AC 30 ms
9,640 KB
testcase_26 AC 30 ms
9,776 KB
testcase_27 AC 30 ms
9,644 KB
testcase_28 AC 30 ms
9,732 KB
testcase_29 AC 30 ms
9,764 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)

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]

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()

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]
        if not any(u):
            print('No')
            exit()

print('Yes')
0