#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();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
11980 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
11980 KB |
Output isn't correct |
3 |
Incorrect |
8 ms |
11976 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
11980 KB |
Output isn't correct |
5 |
Incorrect |
7 ms |
11980 KB |
Output isn't correct |
6 |
Incorrect |
6 ms |
12088 KB |
Output isn't correct |
7 |
Incorrect |
7 ms |
12108 KB |
Output isn't correct |
8 |
Incorrect |
6 ms |
12108 KB |
Output isn't correct |
9 |
Incorrect |
7 ms |
12108 KB |
Output isn't correct |
10 |
Incorrect |
8 ms |
12236 KB |
Output isn't correct |
11 |
Incorrect |
13 ms |
12620 KB |
Output isn't correct |
12 |
Incorrect |
18 ms |
13064 KB |
Output isn't correct |
13 |
Incorrect |
43 ms |
14888 KB |
Output isn't correct |
14 |
Incorrect |
54 ms |
15976 KB |
Output isn't correct |
15 |
Incorrect |
93 ms |
21632 KB |
Output isn't correct |
16 |
Incorrect |
110 ms |
22468 KB |
Output isn't correct |
17 |
Incorrect |
138 ms |
24040 KB |
Output isn't correct |
18 |
Incorrect |
165 ms |
25716 KB |
Output isn't correct |
19 |
Incorrect |
210 ms |
28160 KB |
Output isn't correct |
20 |
Incorrect |
235 ms |
28100 KB |
Output isn't correct |