HDU 6150 Vertex Cover(构造)

时间:2021-01-12 21:26:01

http://acm.hdu.edu.cn/showproblem.php?pid=6150

HDU 6150 Vertex Cover(构造)

 #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn=+; const int n=;
struct node
{
int u,v;
}e[maxn]; int main()
{
//freopen("in.txt","r",stdin);
int cnt=n;
int e_cnt=;
for(int i=;i<=n;i++)
{
int num=n/i;
int left=;
for(int j=;j<=num;j++)
{
for(int k=;k<=i;k++)
{
e[e_cnt].u=left;
e[e_cnt].v=cnt+j;
e_cnt++;
left++;
}
}
cnt+=num;
}
printf("%d %d\n",cnt,e_cnt);
for(int i=;i<e_cnt;i++) printf("%d %d\n",e[i].u,e[i].v);
printf("%d\n",n);
for(int i=;i<=n;i++) printf("%d\n",i);
return ;
}