写完征文脑子一团乱麻,根本想不出哪里有问题
#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
struct node{
int num; // 编号
int t; // 得分(解决题目数量)
}a[N];
bool cmp(node a,node b){
return (a.t==b.t?a.num<b.num:a.t>b.t);
}
int n,t,p,s[N];
bool b[N][N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(NULL);
cin >> n >> t >> p;
for(int i = 1; i <= n; i++){
int x;
for(int j = 1; j <= t; j++){
cin >> x;
b[i][j] = x;
s[j] += x;
}
a[i].num = i;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= t; j++){
if(b[i][j]){
a[i].t += (n-s[j]);
}
}
}
sort(a+1,a+1+n,cmp);
for(int i = 1; i <= n; i++){
if(a[i].num == p){
cout << a[i].t << " " << i << endl;
return 0;
}
}
return 0;
}
预言:肯定是因为我傻逼了