結果

問題 No.3341 Making Beautiful Graphs
コンテスト
ユーザー titia
提出日時 2025-11-14 01:55:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2025-11-14 01:55:24
合計ジャッジ時間 6,966 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())

if N<=2:
    print(-1)
else:
    ANS=set()

    for i in range(1,N*N+1):
        for j in [i-1,i-N,i+1,i+N]:
            if j>N*N:
                j-=N*N
            if j<=0:
                j+=N*N
            X=[i,j]
            X.sort()
            ANS.add(tuple(X))

    print(len(ANS))

    for x,y in ANS:
        print(x,y)
0