1641. Duties

时间:2021-01-15 11:02:26

1641

枚举

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<vector>
using namespace std;
int w[][],o[];
int main()
{
int i,j,k,n,m;
scanf("%d%d%d",&n,&k,&m);
int t = ;
for(i = ; i <= n ; i++)
{
if(t>k)
t = ;
o[i] = t;
printf("%d\n",t);
t++;
}
int tt=,a=;
while()
{
if(a<=n)
{
if(a<n)
{
printf("%d %d\n",a,a+);
w[a][a+] = ;
w[a+][a] = ;
a+=;
}
else
{
printf("%d %d\n",n-,n);
w[n-][n] =;
w[n][n-] = ;
a++;
}
tt++;
}
else
{
for(i = ; i <= n ;i++)
{
for(j = ; j <= n ; j++)
if(i!=j&&!w[i][j]&&o[i]!=o[j])
{
printf("%d %d\n",i,j);
w[i][j] = ;
w[j][i] = ;
tt++;
if(tt==m)
break;
}
if(tt==m)
break;
}
}
if(tt==m)
break;
}
return ;
}

相关文章