标签:
思路:构造,显然是一个蝴蝶形状的图
#include<bits\stdc++.h> using namespace std; int main() { int n,k,a,b,c,d; vector<int>g; scanf("%d%d",&n,&k); scanf("%d%d%d%d",&a,&b,&c,&d); if(n==4) { puts("-1"); return 0; } if (k<=n) { puts("-1"); return 0; } for (int i = 1;i<=n;i++) { if(i==a||i==b||i==c||i==d) continue; g.push_back(i); } printf("%d %d ",a,c); for (int i = 0;i<g.size();i++) printf("%d ",g[i]); printf("%d %d\n",d,b); printf("%d %d ",c,a); for (int i = 0;i<g.size();i++) printf("%d ",g[i]); printf("%d %d\n",b,d); }
CodeForces 673D Bear and Two Paths(构造)
标签:
原文地址:http://blog.csdn.net/qq_21057881/article/details/51365984