# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718790 | NintsiChkhaidze | Poi (IOI09_poi) | C++14 | 223 ms | 39500 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |