結果
問題 | No.2446 完全列 |
ユーザー | Kude |
提出日時 | 2023-08-25 23:13:41 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,686 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-06-06 20:29:23 |
合計ジャッジ時間 | 1,894 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
11,520 KB |
testcase_01 | WA | - |
testcase_02 | AC | 30 ms
11,520 KB |
testcase_03 | AC | 30 ms
11,392 KB |
testcase_04 | AC | 30 ms
11,392 KB |
testcase_05 | AC | 30 ms
11,520 KB |
testcase_06 | AC | 32 ms
11,392 KB |
testcase_07 | AC | 31 ms
11,520 KB |
testcase_08 | AC | 31 ms
11,392 KB |
testcase_09 | WA | - |
testcase_10 | AC | 33 ms
11,392 KB |
testcase_11 | AC | 31 ms
11,392 KB |
testcase_12 | AC | 31 ms
11,392 KB |
testcase_13 | AC | 31 ms
11,264 KB |
testcase_14 | AC | 33 ms
11,392 KB |
testcase_15 | AC | 29 ms
11,520 KB |
testcase_16 | AC | 32 ms
11,520 KB |
testcase_17 | AC | 33 ms
11,392 KB |
testcase_18 | AC | 31 ms
11,648 KB |
testcase_19 | AC | 31 ms
11,392 KB |
testcase_20 | AC | 30 ms
11,392 KB |
testcase_21 | AC | 29 ms
11,392 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 30 ms
11,520 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 30 ms
11,392 KB |
ソースコード
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 = [bi[:] for bi in 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')