結果

問題 No.3012 岩井星人グラフ
コンテスト
ユーザー のらら
提出日時 2025-10-29 20:05:49
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,258 bytes
コンパイル時間 3,235 ms
コンパイル使用メモリ 179,460 KB
実行使用メモリ 9,428 KB
最終ジャッジ日時 2025-10-29 20:06:02
合計ジャッジ時間 12,051 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
//#define endl "\n";
ll x, y;
vector<pair<ll,ll>> v;

int main(){
  cin >> x >> y;
  if(x == 3){
    for(int i = 1; i < x; i++) v.push_back({i, i + 1});
    v.push_back({x, 1});
    ll nex = x + 1;
    for(int i = 1; i <= x; i++){
      int pos = i;
      for(int j = 1; j < y; j++){
        v.push_back({pos, nex});
        pos = nex;
        nex++;
      }
    }
    cout << v.size() << " " << v.size() << endl;
    for(auto [a, b]: v) cout << a << " " << b << endl;
  }else{
    for(int i = 1; i < x; i++) v.push_back({i, i + 1});
    v.push_back({x, 1});
    //ループをもう1個ふやす
    v.push_back({1, x / 2 + 1});
    
    ll nex = x + 1;
    for(int i = 1; i <= x; i++){
      if(i == 1 || i == x / 2 + 1) continue;
      int pos = i;
      for(int j = 1; j < y; j++){
        v.push_back({pos, nex});
        pos = nex;
        nex++;
      }
    }
    //のこり2y-2頂点のパスグラフ
    for(int i = 1; i < 2 * y - 2; i++){
      v.push_back({nex, nex + 1});
      nex++;
    }
    cout << v.size() << " " << v.size() << endl;
    for(auto [a, b]: v) cout << a << " " << b << endl;
  }
  return 0;
}
0