src2020/4079_iit/iit.cpp

43 lines
883 B
C++
Raw Normal View History

2020-04-06 10:26:09 +08:00
#include <iostream>
using namespace std;
int cant[101][102] = { 0 };
int ans[101] = { 0 };
bool kouwei[101][5] = { 0 };
int n, m; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>
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];
}
}