# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
405598 | Jasiekstrz | Poi (IOI09_poi) | C++17 | 331 ms | 16580 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 fi first
#define se second
using namespace std;
const int N=2e3;
struct W
{
int s,c,id;
bool operator<(const W &oth)
{
if(s==oth.s && c==oth.c)
return id<oth.id;
else if(s==oth.s)
return c>oth.c;
return s>oth.s;
}
};
int sc[N+10];
int tab[N+10][N+10];
W w[N+10];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,t,p;
cin>>n>>t>>p;
for(int i=1;i<=t;i++)
sc[i]=n;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=t;j++)
{
cin>>tab[i][j];
if(tab[i][j])
sc[j]--;
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=t;j++)
{
w[i].s+=tab[i][j]*sc[j];
w[i].c+=tab[i][j];
}
w[i].id=i;
}
sort(w+1,w+n+1);
for(int i=1;i<=n;i++)
{
if(w[i].id==p)
{
cout<<w[i].s<<" "<<i<<"\n";
break;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |