Submission #522609

#TimeUsernameProblemLanguageResultExecution timeMemory
522609ddy888Poi (IOI09_poi)C++17
100 / 100
232 ms17384 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define rep(i,a,b) for (int i = a; i < b; i++) #define db(x) cerr << "[ " << #x << ": " << x << " ]"; #define fast ios_base::sync_with_stdio(0); cin.tie(0) typedef pair<int,int> pi; typedef pair<pi,int> pii; ll n,t,p,done[2005]; vector<int> v[2005]; vector<tuple<int,int,int> > score; // score, position, solves bool cmp(tuple<int,int,int> a, tuple<int,int,int> b) { if (get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b); else if (get<2>(a) != get<2>(b)) return get<2>(a) > get<2>(b); else return get<1>(a) < get<1>(b); } int main() { fast; cin >> n >> t >> p; rep(i,0,n) { rep(j,0,t) { int tp; cin >> tp; if (tp == 1) v[i].pb(j); done[j] += tp; } } rep(i,0,n) { ll tmp = 0; for (auto it: v[i]) { tmp += n - done[it]; } score.pb(make_tuple(tmp,i,v[i].size())); } sort(score.begin(),score.end(),cmp); ll cnt = 1; for (auto it: score) { if (get<1>(it)+1 == p) { cout << get<0>(it) << " " << cnt; return 0; } cnt++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...