# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018155 | Faggi | Poi (IOI09_poi) | C++11 | 373 ms | 16148 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;
int main()
{
int n, t, p, i, j, tasks, punts, a;
cin >> n >> t >> p;
vector<vector<int>> v(n, vector<int>(t));
vector<int> punt(t, n);
vector<tuple<int, int, int>> tabla; // (puntaje, tareas resueltas, id)
for(i = 0; i < n; i++)
{
for(j = 0; j < t; j++)
{
cin >> a;
if(a)
{
punt[j]--;
}
v[i][j] = a;
}
}
for(i = 0; i < n; i++)
{
punts = 0;
tasks = 0;
for(j = 0; j < t; j++)
{
if(v[i][j])
{
tasks++;
punts += punt[j];
}
}
tabla.push_back(make_tuple(punts, tasks, i));
}
// Ordenar tabla: primero por puntaje descendente, luego por tareas resueltas descendente, luego por id ascendente
sort(tabla.begin(), tabla.end(), [](const tuple<int, int, int>& a, const tuple<int, int, int>& b) {
if(get<0>(a) != get<0>(b))
return get<0>(a) > get<0>(b); // puntaje descendente
if(get<1>(a) != get<1>(b))
return get<1>(a) > get<1>(b); // tareas resueltas descendente
return get<2>(a) < get<2>(b); // id ascendente
});
for(i = 0; i < int(tabla.size()); i++)
{
if(get<2>(tabla[i]) == (p - 1))
{
cout << get<0>(tabla[i]) << " " << (i + 1);
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |