結果
| 問題 |
No.3012 岩井星人グラフ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 13:06:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,418 bytes |
| コンパイル時間 | 2,872 ms |
| コンパイル使用メモリ | 280,256 KB |
| 実行使用メモリ | 5,332 KB |
| 最終ジャッジ日時 | 2025-01-25 22:33:49 |
| 合計ジャッジ時間 | 7,966 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef local
#include <debug.hpp>
#else
#define debug(...)
#endif
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> istream& operator>>(istream& I, vector<T>& V) {for (T& X : V) I >> X; return I;}
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
vector<int> di = {-1, 1, 0, 0}, dj = {0, 0, -1, 1}; int inf = 2e9; long INF = 1e18;
int main() {
int x, y;
cin >> x >> y;
int n = 2 * x + x * (y - 2);
vector<pair<int, int>> es;
rep(i, x) {
es.emplace_back(i, (i + 1) % x);
}
int idx = x, b = n - x;
rep(i, x) {
rep(j, y - 2) {
if (j == 0) {
es.emplace_back(i, idx++);
}
if (j == y - 3) {
if (j == 0) {
es.emplace_back(idx - 1, b++);
} else {
es.emplace_back(idx++, b++);
}
}
if (j != 0 and j != y - 3) {
es.emplace_back(idx - 1, idx++);
}
}
}
// vector<int> d(n);
// for (auto [u, v] : es) {
// d[u]++;
// d[v]++;
// }
// debug(d);
for (auto [u, v] : es) {
cout << u + 1 << " " << v + 1 << endl;
}
return 0;
}