結果

問題 No.3341 Making Beautiful Graphs
コンテスト
ユーザー kotatsugame
提出日時 2025-11-13 22:54:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 64,404 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-13 22:54:35
合計ジャッジ時間 3,845 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin>>N;
	if(N<=2)
	{
		cout<<-1<<endl;
		return 0;
	}
	cout<<N*N*2<<"\n";
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)
	{
		int u=i*N+j+1;
		cout<<u<<" "<<(u+1-1)%(N*N)+1<<"\n";
		cout<<u<<" "<<(u+N-1)%(N*N)+1<<"\n";
	}
}
0