// In the name of god
// A.H.Ghaznavi
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,k,x[110][110],r;
pair <int,int> p[110];
bool tf[110];
int main()
{
for (int i=0;i<110;i++)
p[i].second=110-i;
cin>>n>>m>>k;
for (int i=1;i<=n;i++)
{
for (int i2=1;i2<=m;i2++)
cin>>x[i][i2];
}
for (int i=1;i<=n;i++)
p[x[i][1]].first++;
sort(p, p+m+1);
tf[110-p[m].second]=true;
cout<<110-p[m].second<<endl;
while (!tf[k])
{
tf[110-p[m].second]=true;
r++;
for (int i=1;i<=m;i++)
{
if (tf[i])
p[i].first=-1;
else
p[i].first=0;
}
for (int i=0;i<110;i++)
p[i].second=110-i;
for (int i=1;i<=n;i++)
{
for (int i2=1;i2<=m;i2++)
{
if (!tf[x[i][i2]])
{
p[x[i][i2]].first++;
break;
}
}
}
sort(p, p+m+1);
tf[110-p[m].second]=true;
}
cout<<r;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Partially correct |
3 ms |
496 KB |
Partially correct |
4 |
Partially correct |
3 ms |
508 KB |
Partially correct |
5 |
Partially correct |
3 ms |
508 KB |
Partially correct |
6 |
Partially correct |
3 ms |
532 KB |
Partially correct |
7 |
Partially correct |
3 ms |
752 KB |
Partially correct |
8 |
Partially correct |
2 ms |
752 KB |
Partially correct |
9 |
Partially correct |
3 ms |
752 KB |
Partially correct |
10 |
Partially correct |
3 ms |
752 KB |
Partially correct |
11 |
Correct |
2 ms |
776 KB |
Output is correct |
12 |
Correct |
4 ms |
776 KB |
Output is correct |
13 |
Partially correct |
3 ms |
776 KB |
Partially correct |
14 |
Partially correct |
5 ms |
776 KB |
Partially correct |
15 |
Partially correct |
3 ms |
776 KB |
Partially correct |
16 |
Partially correct |
3 ms |
776 KB |
Partially correct |
17 |
Partially correct |
3 ms |
780 KB |
Partially correct |
18 |
Partially correct |
3 ms |
860 KB |
Partially correct |
19 |
Partially correct |
3 ms |
860 KB |
Partially correct |
20 |
Partially correct |
3 ms |
860 KB |
Partially correct |