제출 #542890

#제출 시각아이디문제언어결과실행 시간메모리
542890Sho10Poi (IOI09_poi)C++17
100 / 100
201 ms25412 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=1000000007; ld const PI=3.14159265359; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n,t,p,cnt[2005]; vector<ll>v[2005]; pair<ll,pair<ll,ll>>a[2005]; bool cmp(pair<ll,pair<ll,ll>>x,pair<ll,pair<ll,ll>>y){ if(x.f!=y.f){ return x.f>y.f; } if(x.s.f!=y.s.f){ return x.s.f>y.s.f; } return x.s.s<y.s.s; } int32_t main(){ CODE_START; cin>>n>>t>>p; for(ll i=1;i<=t;i++) { cnt[i]=n; } for(ll i=1;i<=n;i++) { for(ll j=1;j<=t;j++) { ll x; cin>>x; if(x==1){ v[i].pb(j); cnt[j]--; } } } for(ll i=1;i<=n;i++) { ll sum1=0,sum2=0,sum3=0; for(auto it : v[i]){ sum1+=cnt[it]; sum2++; } sum3=i; a[i].f=sum1; a[i].s.f=sum2; a[i].s.s=sum3; } sort(a+1,a+n+1,cmp); for(ll i=1;i<=n;i++) { if(a[i].s.s==p){ cout<<a[i].f<<' '<<i<<endl; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...