# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659797 | Gabi88 | Poi (IOI09_poi) | C++14 | 525 ms | 16168 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;
#define LL long long
#define F first
#define S second
vector<pair<int, pair<int, int> > > v;
int n, m, k, l[2009][2009], rj[2009], na[2009], sum, usp = -1, pos = -1, br = 1;
int main(){
cin >> n >> m >> k;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin >> l[i][j];
na[i] += l[i][j];
rj[j] += (l[i][j]+1)%2;
}
}
for(int i=0; i<n; i++){
sum = 0;
for(int j=0; j<m; j++) sum += rj[j]*l[i][j];
v.push_back(make_pair(sum, make_pair(na[i], i+1)));
}
sort(v.begin(), v.end());
sum = -1;
for(int i=n-1; i >= 0; i--){
if (sum != v[i].first or usp != v[i].second.first){
sum = v[i].first;
usp = v[i].second.first;
pos = br;
}
if (v[i].second.second == k){cout << sum << " " << pos; return 0;}
br++;
}
return 0;
}
/*
6 4 4
0 0 1 1
1 0 1 0
1 1 1 1
0 0 0 1
0 1 1 0
1 0 0 0
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |