結果
問題 |
No.466 ジオラマ
|
ユーザー |
![]() |
提出日時 | 2023-07-15 03:22:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,660 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 14,464 KB |
最終ジャッジ日時 | 2024-09-16 12:03:26 |
合計ジャッジ時間 | 7,552 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 82 WA * 1 |
ソースコード
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+1)%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)