結果

問題 No.466 ジオラマ
ユーザー maspymaspy
提出日時 2020-03-22 06:49:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,128 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 11,068 KB
実行使用メモリ 11,884 KB
最終ジャッジ日時 2023-08-26 03:16:41
合計ジャッジ時間 10,850 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,396 KB
testcase_01 AC 16 ms
8,208 KB
testcase_02 WA -
testcase_03 AC 16 ms
8,172 KB
testcase_04 AC 16 ms
8,228 KB
testcase_05 AC 15 ms
8,232 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 28 ms
10,024 KB
testcase_31 AC 27 ms
9,936 KB
testcase_32 AC 27 ms
9,844 KB
testcase_33 AC 26 ms
9,620 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 22 ms
9,052 KB
testcase_37 AC 18 ms
9,048 KB
testcase_38 AC 24 ms
9,356 KB
testcase_39 AC 18 ms
9,308 KB
testcase_40 AC 27 ms
9,756 KB
testcase_41 AC 19 ms
9,788 KB
testcase_42 AC 27 ms
9,504 KB
testcase_43 AC 19 ms
9,636 KB
testcase_44 AC 25 ms
9,396 KB
testcase_45 AC 19 ms
9,476 KB
testcase_46 AC 20 ms
8,812 KB
testcase_47 AC 18 ms
8,724 KB
testcase_48 AC 29 ms
9,964 KB
testcase_49 AC 20 ms
9,992 KB
testcase_50 AC 27 ms
9,808 KB
testcase_51 AC 19 ms
9,920 KB
testcase_52 AC 26 ms
9,696 KB
testcase_53 AC 20 ms
9,596 KB
testcase_54 AC 25 ms
9,496 KB
testcase_55 AC 19 ms
9,488 KB
testcase_56 AC 18 ms
8,624 KB
testcase_57 AC 17 ms
8,660 KB
testcase_58 AC 17 ms
8,460 KB
testcase_59 AC 16 ms
8,288 KB
testcase_60 AC 21 ms
8,988 KB
testcase_61 AC 18 ms
8,832 KB
testcase_62 AC 19 ms
8,896 KB
testcase_63 AC 17 ms
8,824 KB
testcase_64 AC 18 ms
8,548 KB
testcase_65 AC 17 ms
8,604 KB
testcase_66 AC 30 ms
10,228 KB
testcase_67 AC 21 ms
10,244 KB
testcase_68 AC 25 ms
9,604 KB
testcase_69 AC 19 ms
9,636 KB
testcase_70 AC 23 ms
9,320 KB
testcase_71 AC 19 ms
9,276 KB
testcase_72 AC 22 ms
9,052 KB
testcase_73 AC 18 ms
9,008 KB
testcase_74 AC 27 ms
9,660 KB
testcase_75 AC 19 ms
9,700 KB
testcase_76 AC 21 ms
10,384 KB
testcase_77 AC 20 ms
9,456 KB
testcase_78 AC 20 ms
10,488 KB
testcase_79 AC 20 ms
10,072 KB
testcase_80 AC 20 ms
10,008 KB
testcase_81 RE -
testcase_82 AC 15 ms
8,324 KB
testcase_83 AC 16 ms
8,244 KB
testcase_84 AC 31 ms
10,420 KB
testcase_85 AC 42 ms
11,884 KB
testcase_86 AC 15 ms
8,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C, D = map(int, read().split())


def output(edges):
    A, B = zip(*edges)
    N = 1 + max(A + B)
    M = len(edges)
    if M > D:
        print(-1)
    else:
        print(N, M)
        for a, b in zip(A, B):
            print(a, b)


def solve(A, B, C):
    if A == B == C:
        if A == 1:
            print(-1)
            exit()
        return [(n, (n + 1) % A) for n in range(A)]
    edges = []
    if A == C < B:
        edges += [(1, 0)]
        for n in range(2, C + 1):
            edges.append((0, n))
        for n in range(C + 1, B):
            edges.append((1, n))
        return edges
    if B == C < A:
        edges += [(0, 1)]
        for n in range(2, C + 1):
            edges.append((1, n))
        for n in range(C + 1, A):
            edges.append((0, n))
        return edges
    for n in range(2, A + 1):
        edges.append((0, n))
    for n in range(A + 1, A + B):
        edges.append((1, n))
    return edges


edges = solve(A, B, C)
output(edges)

0