# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
307592 | sofapuden | Poi (IOI09_poi) | C++14 | 1071 ms | 31896 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;
typedef long long ll;
bool comp(pair<pair<ll,ll>,ll> a, pair<pair<ll,ll>,ll> 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(){
ll n, t, p; cin >> n >> t >> p;
vector<ll> points(t,0);
vector<vector<ll>> ans(n, vector<ll> (t));
for(auto &x : ans)for(auto &y : x)cin >> y;
for(ll i = 0; i < n; ++i){
for(ll j = 0; j < t; ++j){
points[j]+=!ans[i][j];
}
}
vector<pair<pair<ll,ll>,ll>> order;
for(ll i = 0; i < n; ++i){
ll cn = 0;
ll po = 0;
for(ll 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(ll 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... |