# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108586 | LeonidCuk | Poi (IOI09_poi) | C++17 | 407 ms | 24240 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>
using namespace std;
struct pom
{
int sum=0,zad=0,id=0;
};
bool cmp(pom &a,pom &b)
{
if(a.sum==b.sum)
{
if(a.zad==b.zad)
{
return a.id<b.id;
}
return a.zad>b.zad;
}
return a.sum>b.sum;
}
int main()
{
int n,m,k,a;
cin>>n>>m>>k;
k--;
vector<int>dp(m,n);
vector<int>v[n];
vector<pom>g(n);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a;
if(a==1)dp[j]--;
v[i].push_back(a);
}
}
for(int i=0;i<n;i++)
{
g[i].id=i;
for(int j=0;j<m;j++)
{
if(v[i][j]==1)
{
g[i].sum+=dp[j];
g[i].zad++;
}
}
}
sort(g.begin(),g.end(),cmp);
for(int i=0;i<n;i++)
{
if(g[i].id==k)
{
cout<<g[i].sum<<" "<<i+1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |