# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
617777 | Icebear16 | Poi (IOI09_poi) | C++14 | 272 ms | 31676 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;
typedef long long ll;
#define INF 1e18//change to const int INF=1e18 if causing problem
const ll MOD=998244353;
const ll alt=1e10;
const ll inf=1e9+7;//Precalc is not a bad idea
#define int ll
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define mod(a) (a+inf)%inf
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) a.size()
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
/* run this program using the console pauser or add your own getch, system("pause") or input loop*/
struct triple{
int b;
int c;
int d;
};
bool cmp(triple a,triple aa){
if(a.b!=aa.b) return a.b>aa.b;
else{
if(a.c!=aa.d) return a.c>aa.c;
else return a.d<aa.d;
}
}
int32_t main(){
std::ios_base::sync_with_stdio(false);
// cin.tie(0)->sync_with_stdio(0);
int n,t,p;
cin>>n>>t>>p;
int a[n][t];
vector<int> v(t,0);
vector<triple> e(n);
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
cin>>a[i][j];
}
}
for(int i=0;i<t;i++){
for(int j=0;j<n;j++){
if(a[j][i]==0) v[i]++;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<t;j++){
if(a[i][j]==1) a[i][j]=v[j];
}
}
for(int i=0;i<n;i++){
int y=0,x=0;
for(int j=0;j<t;j++){
x+=a[i][j];
if(a[i][j]>0) y++;
}
e[i].b=x;
e[i].c=y;
e[i].d=i+1;
}
sort(all(e),cmp);
int ans1,ans2;
for(int i=0;i<n;i++){
if(e[i].d==p){
ans1=e[i].b;
ans2=i+1;
break;
}
}
cout<<ans1<<" "<<ans2<<endl;
return 0;
}
//Icebear16
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |