Submission #601189

#TimeUsernameProblemLanguageResultExecution timeMemory
601189SlyGaleebPoi (IOI09_poi)C++17
100 / 100
255 ms24264 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define ld long double #define F first #define S second const ll N = 2e5 + 5; vector<int>v[2005]; bool cmp (const pair<pair<int,int>,int>&a, const pair<pair<int,int>,int>&b) { if (a.F==b.F) return a.S<b.S; if (a.F.F==b.F.F) return a.F.S>b.F.S; return a.F.F>b.F.F; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,t,p; cin >> n >> t >> p; vector<int>mark(t,0); for (int i = 1; i <= n; ++i) { for (int j = 0; j < t; ++j) { int a; cin >> a; v[i].push_back(a); } } for (int j = 0; j < t; ++j) { int cnt = 0; for (int i = 1; i <= n; ++i) { if (v[i][j]==0) cnt++; } mark[j] = cnt; } vector<pair<pair<int,int>,int>>standing; for (int i = 1; i <= n; ++i) { int score=0, solved = 0; for (int j = 0; j < t; ++j) { if (v[i][j]==1) { solved++; score+=mark[j]; } } standing.push_back({{score,solved},i}); } sort(standing.begin(),standing.end(),cmp); for (int i = 0; i < n; ++i) { if (standing[i].S==p) { cout << standing[i].F.F << " " << i+1; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...