結果

問題 No.3012 岩井星人グラフ
ユーザー さわーくりーむおにおん🧅
提出日時 2025-01-25 12:47:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 920 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 106,336 KB
最終ジャッジ日時 2025-01-25 22:21:17
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate, combinations, permutations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from operator import itemgetter
import math
from heapq import heapify, heappush, heappop

LMI=lambda:list(map(int, input().split()))
LMS=lambda:list(map(str, input().split()))
MI=lambda:map(int, input().split())
MS=lambda:map(str, input().split())
II=lambda:int(input())
IS=lambda:input().split()
LI=lambda:list(input())

X,Y=MI()
N,M=X*Y, X*Y

ans=[]
#真ん中X角形書いてみる
for i in range(1,X+1):
    if i!=X:
        ans.append([i, i+1])
    else:
        ans.append([i, 1])
#腕を書く
cnt=X+1
for i in range(1,X+1):
    for j in range(Y-1):
        if j==0:
            ans.append([i, cnt])
        else:
            ans.append([cnt-1, cnt])
        cnt+=1
print(N,M)
for i in ans:
    print(*i)

0