# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074805 | ilikeeggs | Poi (IOI09_poi) | C++14 | 191 ms | 39752 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 int long long
bool customSort(vector<int> l, vector<int> r){
if (l[0] != r[0])
return l[0] < r[0];
else if (l[1] != r[1])
return l[1] < r[1];
else
return l[2] > r[2];
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,t,p;
cin>>n>>t>>p;
vector<vector<int>> ori(n, vector<int>(t)), fin(n, vector<int>(3));
vector<int> solves(t);
for(int i=0; i<n; i++){
for(int j=0; j<t; j++){
bool x;
cin>>x; // input is either 1 or 0
ori[i][j] = x;
solves[j] += x;
}
fin[i][2] = i + 1;
}
for(int i=0; i<n; i++){
int solved = 0;
for(int j=0; j<t; j++){
fin[i][0] += (n - solves[j]) * ori[i][j];
solved += ori[i][j];
}
fin[i][1] = solved;
}
sort(fin.begin(), fin.end(), customSort);
int r = n;
for(int i=0; i<n; i++){
if(fin[i][2] == p)
cout << fin[i][0] << ' ' << r << endl;
r--;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |