結果

問題 No.1711 Divide LCM
ユーザー 👑 tamatotamato
提出日時 2021-10-15 22:37:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,412 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 256,628 KB
最終ジャッジ日時 2023-10-17 20:35:22
合計ジャッジ時間 13,486 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
58,164 KB
testcase_01 AC 37 ms
53,816 KB
testcase_02 AC 37 ms
53,812 KB
testcase_03 AC 66 ms
71,088 KB
testcase_04 AC 130 ms
77,876 KB
testcase_05 AC 382 ms
80,940 KB
testcase_06 AC 172 ms
77,988 KB
testcase_07 AC 374 ms
80,608 KB
testcase_08 AC 110 ms
78,500 KB
testcase_09 AC 192 ms
83,488 KB
testcase_10 AC 101 ms
77,936 KB
testcase_11 AC 190 ms
85,032 KB
testcase_12 AC 101 ms
77,928 KB
testcase_13 AC 56 ms
66,492 KB
testcase_14 AC 109 ms
77,304 KB
testcase_15 AC 97 ms
77,380 KB
testcase_16 AC 55 ms
66,408 KB
testcase_17 AC 91 ms
77,048 KB
testcase_18 AC 261 ms
116,344 KB
testcase_19 AC 281 ms
119,140 KB
testcase_20 AC 262 ms
119,136 KB
testcase_21 AC 301 ms
152,560 KB
testcase_22 AC 508 ms
99,560 KB
testcase_23 AC 869 ms
115,300 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
eps = 10**-9


def main():
    import sys
    from itertools import combinations
    input = sys.stdin.readline

    N = int(input())
    A = []
    PE = []
    P = {}
    for i in range(N):
        M = int(input())
        a = 1
        D = {}
        for j in range(M):
            p, e = map(int, input().split())
            if p not in P:
                P[p] = 0
            P[p] = max(P[p], e)
            a *= p ** e
            D[p] = e
        A.append(a)
        PE.append(D)

    B = []
    for i in range(N):
        D = PE[i]
        b = set()
        for p in D:
            if D[p] == P[p]:
                b.add(p)
        B.append(b)

    L = len(P)
    P_list = list(P.keys())
    for k in range(2, L+1):
        for J in combinations(P_list, k):
            J = list(J)
            ans = [[] for _ in range(k)]
            flg = 1
            for i, b in enumerate(B):
                ok = 0
                for j, pp in enumerate(J):
                    if pp not in b:
                        ans[j].append(A[i])
                        ok = 1
                        break
                if not ok:
                    flg = 0
                    break
            if flg:
                print(k)
                for a in ans:
                    a = [len(a)] + a
                    print(*a)
                exit()
    print(-1)


if __name__ == '__main__':
    main()
0