# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522266 | new_acc | Poi (IOI09_poi) | C++14 | 223 ms | 28156 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 fi first
#define se second
#define rep(a, b) for(int a = 0; a < (int)(b); a++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=5e5+10;
pair<int,int>t[N];
int ile[N],zr[N];
vi xd[N];
void solve(){
int n,m,p;
cin>>n>>m>>p;
p--;
rep(i,n){
rep(j,m){
int a;
cin>>a;
ile[j]+=!a;
xd[i].push_back(a);
}
}
rep(i,n){
rep(j,m) if(xd[i][j]==1) t[i].fi+=ile[j],zr[i]++;
t[i].se=i;
}
sort(t,t+n,[](pair<int,int> a,pair<int,int> b){
if(a.fi==b.fi){
if(zr[a.se]==zr[b.se]) return a.se<b.se;
return zr[a.se]>zr[b.se];
}
return a.fi>b.fi;
});
rep(i,n) if(t[i].se==p) cout<<t[i].fi<<" "<<i+1<<"\n";
}
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |