結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int n;
  cin >> n;
  if (n <= 2)
  {
    cout << "-1" << endl;
    return 0;
  }
  cout << n * n * 2 << endl;
  for (int i = 0; i < n * n; ++i)
  {
    int v1 = (i + 1) % (n * n) + 1, v2 = (i + n) % (n * n) + 1;
    cout << i + 1 << ' ' << v1 << endl;
    cout << i + 1 << ' ' << v2 << endl;
  }
}
0