Submission #863307

#TimeUsernameProblemLanguageResultExecution timeMemory
863307HuyQuang_re_ZeroPoi (IOI09_poi)C++14
100 / 100
170 ms16004 KiB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define N 2005
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define rand(l,r) (l+rng()%(r-l+1))
using namespace std;
struct pt { int score,cnt,id; } a[N];
int n,m,p,c[N][N],i,j,point[N],solved[N];
int main()
{
   // freopen("poi.inp","r",stdin);
    //freopen("poi.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>m>>p;
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++) cin>>c[i][j],point[j]+=(1-c[i][j]),solved[i]+=c[i][j];
    for(i=1;i<=n;i++)
    {
        int sum=0;
        for(j=1;j<=m;j++) sum+=point[j]*c[i][j];
        a[i]={ sum,solved[i],i };
    }
    cout<<a[p].score<<" ";
    sort(a+1,a+n+1,[&](pt a,pt b)
         {
             if(a.score!=b.score) return a.score>b.score;
             if(a.cnt!=b.cnt) return a.cnt>b.cnt;
             return a.id<b.id;
         });
    for(i=1;i<=n;i++)
        if(a[i].id==p) cout<<i<<" ";
}
#Verdict Execution timeMemoryGrader output
Fetching results...