# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
659817 | Gabi88 | Poi (IOI09_poi) | C++14 | 532 ms | 31928 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<LL, pair<LL, int> > > v;
unsigned LL n, m, k, l[2009][2009], rj[2009], na[2009], sum, usp, pos;
int cmt(pair<LL, pair<LL, int> > a, pair<LL, pair<LL, int> > b){
if (a.F != b.F) return a.F > b.F;
if (a.S.F != b.S.F) return a.S.F > b.S.F;
return a.S.S > b.S.S;
}
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(), cmt);
for(int i=0; i < n; i++){
if (sum != v[i].F or usp != v[i].S.F or i == 0){
sum = v[i].F;
usp = v[i].S.F;
pos = i+1;
}
if (v[i].S.S == k){cout << sum << " " << pos; return 0;}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |