This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n;
int mat[3001][3001];
int color[3001];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int sub;
cin >> sub;
if(sub==2)
{
cin >> n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin >> mat[i][j];
}
}
int clr=1;
color[0]=1;
for(int i=1;i<n;i++)
{
bool chk=0;
for(int j=i-1;j>=0;j--)
{
if(mat[i][j]==mat[i-1][j])
{
chk=1;
color[i]=color[j];
break;
}
}
if(!chk)
{
color[i]=++clr;
}
}
for(int i=0;i<n;i++)
{
cout << color[i]<<' ';
}
cout <<'\n';
for(int i=0;i<n-1;i++)
{
cout << i+1<<' '<<i+2<<'\n';
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |