Submission #718790

#TimeUsernameProblemLanguageResultExecution timeMemory
718790NintsiChkhaidzePoi (IOI09_poi)C++14
100 / 100
223 ms39500 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define f first #define s second #define int ll using namespace std; const int N = 2e3 + 5; int solved[N],a[N][N]; int score[N],s[N],b[N]; bool cmp(int x,int y){ if (score[x] != score[y]) return (score[x] > score[y]); if (solved[x] != solved[y]) return (solved[x] > solved[y]); return (x < y); } signed main() { ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n,t,p; cin>>n>>t>>p; for (int i=1;i<=t;i++) s[i] = n; for (int i = 1; i <= n; i++){ b[i] = i; for (int j = 1; j <= t; j++){ cin>>a[i][j]; solved[i] += a[i][j]; s[j]-=a[i][j]; } } for (int i = 1; i <= n; i++) for (int j=1;j<=t;j++) score[i] += s[j] * a[i][j]; sort(b+1,b+n+1,cmp); for (int i=1;i<=n;i++) if (b[i] == p) cout<<score[p]<<" "<<i<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...