# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
863307 | HuyQuang_re_Zero | Poi (IOI09_poi) | C++14 | 170 ms | 16004 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 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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |