# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890678 | HasanV11010238 | Poi (IOI09_poi) | C++17 | 471 ms | 24460 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;
bool comparestudents(vector<int> v1, vector<int> v2){
if (v1[0] < v2[0]){
return true;
}
else if (v1[0] > v2[0]){
return false;
}
if (v1[1] < v2[1]){
return true;
}
else if (v1[1] > v2[1]){
return false;
}
if (v1[2] > v2[2]){
return true;
}
return false;
}
int main(){
int n, t, p, a;
cin>>n>>t>>p;
vector<vector<int>> v(n);
vector<int> co(t, n);
vector<vector<int>> stud;
for (int i = 0; i < n; i++){
for (int j = 0; j < t; j++){
cin>>a;
if (a == 1){
co[j] -= 1;
}
v[i].push_back(a);
}
}
for (int i = 0; i < n; i++){
int coun = 0, points = 0;
for (int j = 0; j < t; j++){
points += v[i][j] * co[j];
coun += v[i][j];
}
stud.push_back({points, coun, i + 1});
}
sort(stud.begin(), stud.end(), comparestudents);
reverse(stud.begin(), stud.end());
for (int i = 0; i < n; i++){
if (stud[i][2] == p){
cout<<stud[i][0]<<" "<<i + 1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |