結果

問題 No.466 ジオラマ
ユーザー maspymaspy
提出日時 2020-03-22 06:54:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,430 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 12,000 KB
最終ジャッジ日時 2023-08-26 03:18:21
合計ジャッジ時間 6,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,232 KB
testcase_01 AC 14 ms
8,056 KB
testcase_02 AC 14 ms
8,068 KB
testcase_03 AC 14 ms
8,116 KB
testcase_04 AC 14 ms
8,112 KB
testcase_05 AC 14 ms
8,036 KB
testcase_06 AC 26 ms
9,980 KB
testcase_07 AC 22 ms
9,420 KB
testcase_08 AC 33 ms
11,156 KB
testcase_09 AC 26 ms
9,844 KB
testcase_10 AC 28 ms
10,152 KB
testcase_11 AC 27 ms
9,896 KB
testcase_12 AC 30 ms
10,400 KB
testcase_13 AC 23 ms
9,544 KB
testcase_14 AC 22 ms
9,356 KB
testcase_15 AC 24 ms
9,688 KB
testcase_16 AC 14 ms
8,144 KB
testcase_17 AC 21 ms
9,444 KB
testcase_18 AC 24 ms
9,624 KB
testcase_19 AC 24 ms
9,632 KB
testcase_20 AC 25 ms
9,580 KB
testcase_21 AC 23 ms
9,636 KB
testcase_22 AC 27 ms
10,192 KB
testcase_23 AC 23 ms
9,512 KB
testcase_24 AC 29 ms
10,496 KB
testcase_25 AC 30 ms
10,644 KB
testcase_26 AC 23 ms
9,608 KB
testcase_27 AC 31 ms
10,796 KB
testcase_28 AC 26 ms
10,028 KB
testcase_29 AC 32 ms
10,532 KB
testcase_30 AC 25 ms
9,860 KB
testcase_31 AC 25 ms
9,800 KB
testcase_32 AC 24 ms
9,764 KB
testcase_33 AC 23 ms
9,472 KB
testcase_34 AC 25 ms
10,108 KB
testcase_35 AC 23 ms
9,864 KB
testcase_36 AC 19 ms
8,972 KB
testcase_37 AC 16 ms
8,948 KB
testcase_38 AC 21 ms
9,356 KB
testcase_39 AC 16 ms
9,316 KB
testcase_40 AC 24 ms
9,748 KB
testcase_41 AC 17 ms
9,748 KB
testcase_42 AC 23 ms
9,560 KB
testcase_43 AC 16 ms
9,480 KB
testcase_44 AC 22 ms
9,420 KB
testcase_45 AC 17 ms
9,528 KB
testcase_46 AC 19 ms
8,804 KB
testcase_47 AC 17 ms
8,776 KB
testcase_48 AC 27 ms
10,012 KB
testcase_49 AC 19 ms
10,076 KB
testcase_50 AC 26 ms
9,816 KB
testcase_51 AC 18 ms
9,796 KB
testcase_52 AC 23 ms
9,640 KB
testcase_53 AC 18 ms
9,668 KB
testcase_54 AC 21 ms
9,588 KB
testcase_55 AC 16 ms
9,488 KB
testcase_56 AC 17 ms
8,880 KB
testcase_57 AC 14 ms
8,568 KB
testcase_58 AC 14 ms
8,496 KB
testcase_59 AC 14 ms
8,120 KB
testcase_60 AC 18 ms
9,004 KB
testcase_61 AC 15 ms
8,964 KB
testcase_62 AC 17 ms
8,832 KB
testcase_63 AC 15 ms
8,868 KB
testcase_64 AC 16 ms
8,608 KB
testcase_65 AC 14 ms
8,476 KB
testcase_66 AC 27 ms
10,064 KB
testcase_67 AC 17 ms
10,052 KB
testcase_68 AC 22 ms
9,556 KB
testcase_69 AC 16 ms
9,620 KB
testcase_70 AC 19 ms
9,256 KB
testcase_71 AC 16 ms
9,304 KB
testcase_72 AC 18 ms
9,076 KB
testcase_73 AC 15 ms
9,100 KB
testcase_74 AC 25 ms
9,864 KB
testcase_75 AC 17 ms
9,776 KB
testcase_76 AC 17 ms
10,120 KB
testcase_77 AC 17 ms
9,244 KB
testcase_78 AC 18 ms
10,088 KB
testcase_79 AC 18 ms
10,016 KB
testcase_80 AC 17 ms
9,820 KB
testcase_81 RE -
testcase_82 AC 14 ms
8,360 KB
testcase_83 AC 15 ms
8,164 KB
testcase_84 AC 27 ms
10,372 KB
testcase_85 AC 40 ms
12,000 KB
testcase_86 AC 14 ms
8,260 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
    if C == 0:
        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.append((0, 2))
    edges.append((1, 2))
    for n in range(2, C + 1):
        edges.append((n, n + 1))
    for n in range(C + 2, A + 1):
        edges.append((0, n))
    for n in range(A + 1, A + 1 + B - C - 1):
        edges.append((1, n))
    return edges


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