|
|
back to boardhelp!WA#2 #include<stdio.h> #include<iostream> using namespace std; int a,b,n,m,g[1000][1000]; int _max = -1000; int main() { scanf("%d %d",&n,&m); for(int i = 1;i<=m;i++) { scanf("%d %d",&a,&b); g[a][b]=1; g[b][a]=1; } for(int k = 1;k<=2*n;k++) { for(int l = 1;l<=2*n;l++) { if(k==l){continue;} else if(g[k][l]==1) { g[k][l]=2; g[k][l]=2; } } } for(int k = 1;k<=2*n;k++) { for(int l = 1;l<=2*n;l++) { if(k==l){continue;} else if(g[k][l]==0) { g[k][l]=1; g[k][l]=1; } } } int key = 0; for(int k = 1;k<=2*n;k++) { for(int l = 1;l<=2*n;l++) { if(key>=2){return 0;} else if(k==l){continue;} else if(g[k][l]==1) { printf("%d %d\n",k,l); key++; } } } printf("IMPOSSIBLE"); } |
|
|