43 lines
883 B
C++
43 lines
883 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int cant[101][102] = { 0 };
|
|
int ans[101] = { 0 };
|
|
bool kouwei[101][5] = { 0 };
|
|
int n, m; //²ÍÌü£¬Ñ§Éú
|
|
void dg()
|
|
{
|
|
for (int i = 1; i <=n;i++){
|
|
int w=1;
|
|
//cout<<i<<":";
|
|
while(kouwei[i][w]!=0){
|
|
w++;
|
|
}
|
|
ans[i]=w;
|
|
for(int j=1;j<=cant[i][0];j++){
|
|
//cout<<cant[i][j]<<" ";
|
|
kouwei[cant[i][j]][w]=1;
|
|
}
|
|
//cout<<endl;
|
|
}
|
|
}
|
|
int main()
|
|
{
|
|
cin >> n >> m;
|
|
for (int i = 1; i <= m; i++) {
|
|
int yi, er;
|
|
cin >> yi >> er;
|
|
if (er < yi) {
|
|
int u = er;
|
|
er = yi;
|
|
yi = u;
|
|
}
|
|
if (yi < er) {
|
|
cant[yi][0]++;
|
|
cant[yi][cant[yi][0]] = er;
|
|
}
|
|
}
|
|
dg();
|
|
for(int i=1;i<=n;i++){
|
|
cout<<ans[i];
|
|
}
|
|
} |