結果
問題 | No.3012 岩井星人グラフ |
ユーザー |
|
提出日時 | 2025-01-25 13:07:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,466 bytes |
コンパイル時間 | 3,440 ms |
コンパイル使用メモリ | 280,876 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-25 22:33:43 |
合計ジャッジ時間 | 7,424 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 1 WA * 22 |
ソースコード
#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);cout << n << " " << (int)es.size() << endl;for (auto [u, v] : es) {cout << u + 1 << " " << v + 1 << endl;}return 0;}