# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771912 | cnastea | Poi (IOI09_poi) | C++14 | 471 ms | 15960 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;
vector<int> r(2000), s(2000);
bool f(int k, int l){
if(r[k] > r[l]) return 1;
if(r[k] < r[l]) return 0;
if(s[k] > s[l]) return 1;
if(s[k] < s[l]) return 0;
if(k > l) return 0;
if(k < l) return 1;
}
int main()
{
int n, t, p;
cin >> n >> t >> p;
int a[n][t];
vector<int> q(t);
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
cin >> a[i][j];
if(a[i][j] == 0) q[j]++;
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < t; j++){
if(a[i][j] == 1){
r[i] += q[j];
s[i]++;
}
}
}
vector<int> v(n);
for(int i = 0; i < n; i++) v[i] = i;
sort(v.begin(), v.end(), f);
int i;
for(i = 0; i < n; i++){
if(v[i] == p-1) break;
}
cout << r[p-1] << " " << i+1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |