「日常训练」Regular Bridge(Codeforces Round 306 Div.2 D)

Posted samhx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了「日常训练」Regular Bridge(Codeforces Round 306 Div.2 D)相关的知识,希望对你有一定的参考价值。

题意与分析

图论基础+思维题。

代码

#include <bits/stdc++.h>
#define MP make_pair
#define PB emplace_back
#define fi first
#define se second
#define ZERO(x) memset((x), 0, sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define rep(i, a, b) for (repType i = (a); i <= (b); ++i)
#define per(i, a, b) for (repType i = (a); i >= (b); --i)
#define QUICKIO                      ios::sync_with_stdio(false);     cin.tie(0);                      cout.tie(0);
using namespace std;
using ll=long long;
using repType=int;

int main()
{
    int k; cin>>k;
    if(k%2==0) cout<<"NO"<<endl;
    else 
    {
        cout<<"YES"<<endl;
        cout<<4*k-2<<" "<<2*k*(k-1)+k<<endl;
        cout<<1<<" "<<2<<endl;
        rep(i,3,3+k-1-1) cout<<1<<" "<<i<<endl;
        rep(i,k+2,k+2+k-1-1) cout<<2<<" "<<i<<endl; // k+2 ~ 2*k
        rep(i,3,3+k-1-1)
        {
            rep(j,2*k+1,2*k+1+k-1-1) // 2*k+1 ~ 3*k-1
            {
                cout<<i<<" "<<j<<endl;
            }
        }
        rep(i,k+2,2*k)
        {
            rep(j,3*k,3*k+k-1-1) // 3*k ~ 4*k-2
            {
                cout<<i<<" "<<j<<endl;
            }
        }
        for(int i=2*k+1;i<=3*k-1;i+=2)
        {
            cout<<i<<" "<<i+1<<endl;
        }
        for(int i=3*k;i<=4*k-2;i+=2)
        {
            cout<<i<<" "<<i+1<<endl;
        }

    }
    return 0;
}

以上是关于「日常训练」Regular Bridge(Codeforces Round 306 Div.2 D)的主要内容,如果未能解决你的问题,请参考以下文章

CodeForces 550D Regular Bridge(构造)

cf550D. Regular Bridge(构造)

codeforces #550D Regular Bridge 构造

AtCoder Regular Contest 098

正则表达式小结(Regular Expressions)

AtCoder Regular Contest 101