結果

問題 No.2678 Minmax Independent Set (Hack)
ユーザー ltf0501
提出日時 2025-03-20 19:33:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,293 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 196,236 KB
実行使用メモリ 7,320 KB
最終ジャッジ日時 2025-03-20 19:33:09
合計ジャッジ時間 2,937 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream, ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
  os << "[ ";
	for(auto &x : v)
    os << x << ' ';
	return os << "]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator << (Ostream &os, const pair<Ts...> &p){
  return os << "{" << p.first << ", " << p.second << "}";
}
void dbg_cerr() { cerr << "\e[0m\n"; }
template<typename Head, typename... Tail> void dbg_cerr(Head H, Tail... T) { cerr << ' ' << H; dbg_cerr(T...); }
#ifdef LTF
#define DEBUG(...) cerr << "\e[1;31m[" #__VA_ARGS__ "]:", dbg_cerr(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

void Solve() {
	vector<pair<int, int>> edges;

	constexpr int kN = 10001;
	for (int i = 0; i < kN - 1; i++) edges.emplace_back(i, i + 1);

	int idx = kN;
	for (int i = 2; i < kN - 1; i += 2) {
		edges.emplace_back(i, idx++);
		edges.emplace_back(idx - 1, idx);
		idx++;
		edges.emplace_back(i, idx++);
		edges.emplace_back(idx - 1, idx);
		idx++;
	}

	cout << idx << '\n';
	for (auto &[x, y] : edges) cout << x + 1 << ' ' << y + 1 << '\n';
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
  int T = 1;
  // cin >> T;
  while (T--) {
    Solve();
  }
  return 0;
}
0