# 我们是冠军

1. 解题数越多越靠前
2. 在解题数相同的情况下，罚时越少越靠前
3. 如果某道题目未通过， 则不管提交多少次，都不计算罚时

2 3
13 1 16 1 14 2
13 1 16 1 32 1

2 1

#include<stdio.h>
int main()
{
int a,b,c,d,e,f,h;
scanf("%d%d",&a,&b);
c=b*2;
int n[c],m[c];int o[a],p[a];
for(f=0;f<a;f++)
{o[f]=0; p[f]=0;}
for(e=0;e<a;e++){
for(d=0;d<c;d++){
scanf("%d",&n[d]);

if((d+1)%2==0&&n[d]!=0&&n[d-1]!=0)
{
p[e]=p[e]+1;
}

if((d+1)%2==0&&n[d]!=0&&n[d-1]!=0)
o[e]=o[e]+n[d-1]+20*(n[d]-1);
}
}

int k,g,l;
k=o[0];
g=0;
for(d=0;d<a;d++)

if(o[d]>k)
k=o[d];
l=k;
for(e=0;e<a;e++)
{  k=o[0]; g=0; for(d=0;d<a;d++)
{ if(p[d]>p[g])
{
g=d; k=o[d];
}
else if(o[d]<k&&p[d]==p[g])
{
k=o[d];
g=d;
}
}
p[g]=-1;printf("%d ",g+1);
}
}



#include <bits/stdc++.h>
#define IO                       \
ios::sync_with_stdio(false); \
cin.tie(0);                  \
cout.tie(0);
#define mem(a, x) memset(a, x, sizeof(a))
#define per(x, a, b) for (int x = a; x <= b; x++)
#define rep(x, a, b) for (int x = a; x >= b; x--)

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-8;

struct node {
int ac;
int time;
int id;
} a[1005];
int main() {
#ifdef LOCAL_IM0QIANQIAN
freopen("test.in", "r", stdin);
//    freopen("test.out", "w", stdout);
#else
IO;
#endif // LOCAL_IM0QIANQIAN

int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
a[i].ac = a[i].time = 0;
a[i].id = i + 1;
for (int j = 0; j < k; j++) {
int pen, sub;
cin >> pen >> sub;
if (pen == 0 || sub == 0)
;
else {
++a[i].ac;
a[i].time += pen + (sub - 1) * 20;
}
}
}
sort(a, a + n, [&](const node &x, const node &y) {
if (x.ac == y.ac) {
return x.time < y.time;
}
return x.ac > y.ac;
});
for (int i = 0; i < n; i++) {
cout << a[i].id << " ";
}
cout << endl;
return 0;
}