結果

問題 No.3341 Making Beautiful Graphs
コンテスト
ユーザー GGanari
提出日時 2025-11-19 21:56:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 1,781 ms
コンパイル使用メモリ 194,744 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-19 21:56:18
合計ジャッジ時間 6,348 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define long long long
#define INF 1000000001
#define LNF 10000000011000000001
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);
    
    int n;
    cin >> n;
    int m = n*n;

    if(n < 3)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << m*2 << "\n";

    for(int i = 1; i<=m; i++)
    {
        cout << i << " " << (((i+1) > m) ? i+1-m : i+1) << "\n";
        cout << i << " " << (((i+n) > m) ? i+n-m : i+n) << "\n";
    }
    return 0;
}
0