# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1081884 | Dennis_Jason | Poi (IOI09_poi) | C++17 | 156 ms | 16980 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 NMAX 2005
#define pb push_back
#define eb emplace_back
#define MOD 100003
#define nl '\n'
#define INF 2147483647
#define LLONG_MAX 9223372036854775807
#define pii pair<int,int>
#define tpl tuple<int,int,int>
//#pragma GCC optimize("O3")
using namespace std;
ifstream fin("aib.in");
ofstream fout("aib.out");
/*
*
*
================DEMONSTRATION===================
=====================END========================
*/
int n,t,p;
vector<int>col;
vector<vector<int>>can(NMAX);
vector<pii>part;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>t>>p;
col.resize(t+1);
part.resize(n+1);
for(int i=1;i<=n;++i)
{
for(int j=1;j<=t;++j)
{
int x;
cin>>x;
col[j]+=x;
if(x)
can[i].pb(j);
}
}
for(int i=1;i<=t;++i)
{
col[i]=n-col[i];
}
for(int i=1;i<=n;++i)
{
int aux=0;
for(auto x:can[i])
aux+=col[x];
part[i]={aux,i};
}
auto cmp=[&](pii a,pii b)
{
if(a.first==b.first)
return a.second<b.second;
return a.first<b.first;
};
sort(part.begin(),part.end(),cmp);
for(int i=1;i<=n;++i)
{
auto[x,y]=part[i];
if(y==p)
{
cout<<x<<" "<<i;
return 0;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |