結果

問題 No.3341 Making Beautiful Graphs
コンテスト
ユーザー Naru820
提出日時 2025-11-13 21:40:10
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 730 bytes
コンパイル時間 2,950 ms
コンパイル使用メモリ 281,440 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-13 21:40:26
合計ジャッジ時間 5,400 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define fast cin.tie(nullptr); ios_base::sync_with_stdio(false)
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll mod = 998244353;

int n;
int main(){
    cin >> n;
    if(n <= 2){
        cout << -1 << endl;
        return 0;
    }
    int m = n * n;
    vector<vector<int>> g(m + 1);
    for(int i = 1; i <= m; i++){
        g[i].eb((2 * i) % m);
        g[i].eb((2 * i + 1) % m);
        g[i].eb(m - 1);
        g[i].eb(m );
    }
    cout << m * 2 << endl;
    for(int i = 1; i <= m; i++){
        for(auto to : g[i]){
            if(i < to)cout << i << " " << to << endl;
        }
    }
    return 0;

}
0