結果

問題 No.466 ジオラマ
ユーザー mkawa2mkawa2
提出日時 2020-04-30 16:11:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 2,217 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 11,164 KB
実行使用メモリ 9,124 KB
最終ジャッジ日時 2023-08-22 06:06:59
合計ジャッジ時間 8,736 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,772 KB
testcase_01 AC 19 ms
8,820 KB
testcase_02 AC 21 ms
8,904 KB
testcase_03 AC 20 ms
8,752 KB
testcase_04 AC 20 ms
8,736 KB
testcase_05 AC 20 ms
8,804 KB
testcase_06 AC 29 ms
9,056 KB
testcase_07 AC 26 ms
8,976 KB
testcase_08 AC 34 ms
9,056 KB
testcase_09 AC 27 ms
8,976 KB
testcase_10 AC 29 ms
8,988 KB
testcase_11 AC 27 ms
8,996 KB
testcase_12 AC 31 ms
8,936 KB
testcase_13 AC 26 ms
9,000 KB
testcase_14 AC 26 ms
8,976 KB
testcase_15 AC 27 ms
9,104 KB
testcase_16 AC 21 ms
8,972 KB
testcase_17 AC 25 ms
8,996 KB
testcase_18 AC 27 ms
9,088 KB
testcase_19 AC 27 ms
9,116 KB
testcase_20 AC 27 ms
9,056 KB
testcase_21 AC 26 ms
8,924 KB
testcase_22 AC 29 ms
8,916 KB
testcase_23 AC 27 ms
8,912 KB
testcase_24 AC 30 ms
8,944 KB
testcase_25 AC 32 ms
9,064 KB
testcase_26 AC 27 ms
8,992 KB
testcase_27 AC 32 ms
9,124 KB
testcase_28 AC 29 ms
9,048 KB
testcase_29 AC 31 ms
8,992 KB
testcase_30 AC 28 ms
9,028 KB
testcase_31 AC 29 ms
9,036 KB
testcase_32 AC 28 ms
8,944 KB
testcase_33 AC 26 ms
8,940 KB
testcase_34 AC 29 ms
9,048 KB
testcase_35 AC 28 ms
8,940 KB
testcase_36 AC 24 ms
9,052 KB
testcase_37 AC 20 ms
8,884 KB
testcase_38 AC 26 ms
8,952 KB
testcase_39 AC 21 ms
8,764 KB
testcase_40 AC 26 ms
9,076 KB
testcase_41 AC 20 ms
8,768 KB
testcase_42 AC 26 ms
8,944 KB
testcase_43 AC 21 ms
8,932 KB
testcase_44 AC 25 ms
9,124 KB
testcase_45 AC 20 ms
8,764 KB
testcase_46 AC 23 ms
9,052 KB
testcase_47 AC 20 ms
8,816 KB
testcase_48 AC 29 ms
8,976 KB
testcase_49 AC 21 ms
8,824 KB
testcase_50 AC 28 ms
9,032 KB
testcase_51 AC 21 ms
8,880 KB
testcase_52 AC 28 ms
9,028 KB
testcase_53 AC 20 ms
8,752 KB
testcase_54 AC 26 ms
8,976 KB
testcase_55 AC 21 ms
8,816 KB
testcase_56 AC 24 ms
8,980 KB
testcase_57 AC 21 ms
8,876 KB
testcase_58 AC 22 ms
8,880 KB
testcase_59 AC 21 ms
8,852 KB
testcase_60 AC 24 ms
8,992 KB
testcase_61 AC 21 ms
8,936 KB
testcase_62 AC 28 ms
9,080 KB
testcase_63 AC 23 ms
8,920 KB
testcase_64 AC 23 ms
8,940 KB
testcase_65 AC 21 ms
8,736 KB
testcase_66 AC 31 ms
8,936 KB
testcase_67 AC 22 ms
8,928 KB
testcase_68 AC 30 ms
9,060 KB
testcase_69 AC 24 ms
8,900 KB
testcase_70 AC 27 ms
9,116 KB
testcase_71 AC 22 ms
8,924 KB
testcase_72 AC 28 ms
8,984 KB
testcase_73 AC 21 ms
8,760 KB
testcase_74 AC 33 ms
9,000 KB
testcase_75 AC 21 ms
8,904 KB
testcase_76 AC 22 ms
8,880 KB
testcase_77 AC 21 ms
8,940 KB
testcase_78 AC 22 ms
8,764 KB
testcase_79 AC 21 ms
8,880 KB
testcase_80 AC 22 ms
8,816 KB
testcase_81 AC 22 ms
8,916 KB
testcase_82 AC 21 ms
8,920 KB
testcase_83 AC 22 ms
8,776 KB
testcase_84 AC 36 ms
9,056 KB
testcase_85 AC 43 ms
9,096 KB
testcase_86 AC 22 ms
8,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    def ng():
        print(-1)
        exit()

    a,b,c,d=MI()
    # aを村0「だけ」から、水を受け取る村の数
    # bを村1「だけ」から、水を受け取る村の数にする
    a-=c
    b-=c
    # 不可能なパターン
    if a+b+c<2:ng()
    # すべての村が0,1から受け取る
    if a==0 and b==0:
        if c>d:ng()
        print(a+b+c,c)
        print(0,1)
        print(1,0)
        for i in range(2,c):
            print(1,i)
    # 村1「だけ」から受け取る村の数がない
    elif b==0:
        if a+c-1>d:ng()
        print(a+b+c,a+c-1)
        print(0,1)
        for i in range(2,a+1):
            print(0,i)
        for i in range(a+1,a+c):
            print(1,i)
    # 村0「だけ」から受け取る村の数がない
    elif a==0:
        if b+c-1>d:ng()
        print(a+b+c,b+c-1)
        print(1,0)
        for i in range(2,b+1):
            print(1,i)
        for i in range(b+1,b+c):
            print(0,i)
    # 両方から受け取る村がない
    elif c==0:
        if a+b-2>d:ng()
        print(a+b+c,a+b-2)
        for i in range(2,a+1):
            print(0,i)
        for i in range(a+1,a+b):
            print(1,i)
    # 全パターンある
    else:
        if a+b+c-1>d:ng()
        print(a+b+c,a+b+c-1)
        print(0,2)
        print(1,2)
        for i in range(3,2+a):
            print(0,i)
        for i in range(2+a,1+a+b):
            print(1,i)
        for i in range(1+a+b,a+b+c):
            print(2,i)

main()
0