Submission #307592

#TimeUsernameProblemLanguageResultExecution timeMemory
307592sofapudenPoi (IOI09_poi)C++14
100 / 100
1071 ms31896 KiB
#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 timeMemoryGrader output
Fetching results...