結果

問題 No.466 ジオラマ
ユーザー vwxyz
提出日時 2023-07-15 03:21:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 1,656 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 13,056 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-09-16 12:02:42
合計ジャッジ時間 9,384 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 75 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

A,B,C,D=map(int,readline().split())
if A==C and B==C:
    N=C
    ans_lst=[(i,i%N) for i in range(N)]
elif A==C:
    ans_lst=[]
    ans_lst.append((1,0))
    for i in range(2,A+1):
        ans_lst.append((0,i))
    for i in range(A+1,B):
        ans_lst.append((1,i))
    N=B
elif B==C:
    ans_lst=[]
    ans_lst.append((0,1))
    for i in range(2,B+1):
        ans_lst.append((1,i))
    for i in range(B+1,A):
        ans_lst.append((0,i))
    N=A
else:
    ans_lst=[]
    if C:
        ans_lst.append((0,2))
        ans_lst.append((1,2))
        for i in range(2,C+1):
            ans_lst.append((i,i+1))
    if A-C-1:
        ans_lst.append((0,C+2))
        for i in range(C+2,C+2+(A-C-2)):
            ans_lst.append((i,i+1))
    if B-C-1:
        ans_lst.append((1,A+1))
        for i in range(A+1,A+1+(B-C-2)):
            ans_lst.append((i,i+1))
    N=A+B-C
M=len(ans_lst)
if D<M:
    print(-1)
else:
    print(N,M)
    for a,b in ans_lst:
        print(a,b)
0