#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
620 ms |
50680 KB |
Output is correct |
2 |
Correct |
594 ms |
53324 KB |
Output is correct |
3 |
Correct |
783 ms |
73432 KB |
Output is correct |
4 |
Correct |
847 ms |
74044 KB |
Output is correct |
5 |
Correct |
591 ms |
53224 KB |
Output is correct |
6 |
Correct |
652 ms |
60364 KB |
Output is correct |
7 |
Correct |
482 ms |
49144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |