# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
717734 | AndrijaM | Poi (IOI09_poi) | C++14 | 564 ms | 32488 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;
int main()
{
long long n,t,p;
cin>>n>>t>>p;
long long cpt[t]={0};
vector<long long>v[n];
long long val[n];
memset(val,0,sizeof val);
vector<pair<long long,long long>>r;
for(long long i=0;i<n;i++)
{
for(long long j=0;j<t;j++)
{
long long num;
cin>>num;
v[i].push_back(num);
cpt[j]+=num;///lugje-cpt[j] treba
}
}
for(long long i=0;i<n;i++)
{
for(long long j=0;j<t;j++)
{
if(v[i][j]==1)
val[i]+=n-cpt[j];
}
r.push_back({val[i],i+1});
}
sort(r.rbegin(),r.rend());
vector<pair<int,int>>ans;
bool ok=true;
int pos;
for(long long i=0;i<r.size();i++)
{
if(r[i].first==val[p-1])
{
ans.push_back({r[i].first, r[i].second});
if(ok)
{
pos=i+1;
ok=false;
}
}
}
sort(ans.begin(),ans.end());
for(int i=0;i<ans.size();i++)
{
if(ans[i].second==p-1)
{
pos+=i+1;
}
}
cout<<val[p-1]<<" "<<pos<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |