# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
307590 | sofapuden | Poi (IOI09_poi) | C++14 | 1103 ms | 24668 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bool comp(pair<pair<int,int>,int> a, pair<pair<int,int>,int> b){
if(a.first.first == b.first.first){
if(a.first.second == b.first.second){
return a.second < b.second;
}
return a.first.second > b.first.second;
}
return a.first.first > b.first.first;
}
int main(){
int n, t, p; cin >> n >> t >> p;
vector<int> points(n,0);
vector<vector<int>> ans(n, vector<int> (t));
for(auto &x : ans)for(auto &y : x)cin >> y;
for(int i = 0; i < n; ++i){
for(int j = 0; j < t; ++j){
points[j]+=!ans[i][j];
}
}
vector<pair<pair<int,int>,int>> order;
for(int i = 0; i < n; ++i){
int cn = 0;
int po = 0;
for(int j = 0; j < t; ++j){
cn+=ans[i][j];
po+=ans[i][j]*points[j];
}
order.push_back({{po,cn},i});
}
sort(order.begin(),order.end(), comp);
for(int i = 0; i < n; ++i){
if(order[i].second == p-1){
cout << order[i].first.first << " " << i+1 << "\n";
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |