Submission #931466

#TimeUsernameProblemLanguageResultExecution timeMemory
931466emad234Poi (IOI09_poi)C++17
70 / 100
455 ms19288 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<int,int> const int mod = 1e9 + 7; const int mxN = 2e5 + 5; using namespace std; struct ranking{ int score,num,id; }; ranking ans[mxN]; bool operator<(ranking a,ranking b){ return tie(a.score,a.num,a.id) > tie(b.score,b.num,b.id); } int p[mxN]; int a[2021][2021]; signed main(){ int n,t,P; cin >>n>>t>>P; for(int i = 1;i <= n;i++){ for(int j = 1;j <= t;j++){ cin >>a[i][j]; if(!a[i][j]) p[j]++; } } for(int i = 1;i <= n;i++){ ans[i].id = {i}; for(int j = 1;j <= t;j++){ ans[i].num += (a[i][j]); ans[i].score += (p[j] * a[i][j]); } } sort(ans + 1,ans + n + 1); for(int i = 1;i <= n;i++){ if(ans[i].id == P){ cout<<ans[i].score<<' '<<i; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...