# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1257667 | islam_2010 | Poi (IOI09_poi) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int sz = 2005;
vector<int> v[sz];
struct POI {
int p, ind;
};
bool cmp(POI &a, POI &b){
if(a.p != b.p){
return a.p > b.p;
}return a.ind < b.ind;
}
int main(){
int n, t, p;
cin >> n >> t >> p;
vector<int> mp(t, 0);
vector<POI> a;
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
int a;
cin >> a;
v[i].push_back(a);
if(a == 0){
mp[j]++;
}
}
}
for(int i = 0; i < n; i++){
int pnt = 0;
for(int j = 0; j < t; j++){
if(v[i][j]){
pnt += mp[j];
}
}a.push_back({pnt, i+1});
}sort(a.begin(), a.end(), cmp);
int rank = 0, point = 0;
for(auto i: a){
rank++;
point = i.p;
if(i.ind == p){
break;
}
}cout << point << " " << rank << endl;
}