結果
| 問題 |
No.3341 Making Beautiful Graphs
|
| コンテスト | |
| ユーザー |
AK_Mi
|
| 提出日時 | 2025-11-15 13:22:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 781 bytes |
| コンパイル時間 | 4,282 ms |
| コンパイル使用メモリ | 257,900 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-15 13:22:21 |
| 合計ジャッジ時間 | 7,466 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int main(){
ll n;
cin >> n;
if(n <= 2)cout << -1 << '\n';
else{
cout << n*n*2 << '\n';
vector<vector<ll>> pass(n*n,vector<ll>(0));
for(ll i = 0; i < n*n; i++){
pass[i].push_back((i+1)%(n*n));
pass[i].push_back((n*n+i-1)%(n*n));
pass[i].push_back((i+n)%(n*n));
pass[i].push_back((n*n+i-n)%(n*n));
sort(pass[i].begin(),pass[i].end());
for(ll t = 0; t < 4; t++){
if(i < pass[i][t]){
cout << i+1 << " " << pass[i][t]+1 << '\n';
}
}
}
}
return 0;
}
AK_Mi