# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
322015 | aaronhma | Poi (IOI09_poi) | C++17 | 353 ms | 8940 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;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
struct Person
{
int val;
int id;
};
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, t, p, num;
cin >> n >> t >> p;
unordered_map<int, int> points;
vector<vector<bool>> solved(n, vector<bool>(t));
for (int i = 0; i < n; i++)
{
for (int j = 0; j < t; j++)
{
cin >> num;
if (num == 0)
{
points[j]++;
solved[i][j] = false;
}
else
{
solved[i][j] = true;
}
}
}
vector<Person> people(n);
for (int i = 0; i < n; i++)
{
people[i].id = i + 1;
for (int j = 0; j < t; j++)
{
if (solved[i][j])
{
people[i].val += points[j];
}
}
}
sort(people.begin(), people.end(), [](const Person &a, const Person &b) {
if (a.val == b.val)
return a.id < b.id;
return a.val > b.val;
});
int score = -1, rank = -1;
for (int i = 0; i < n; i++)
{
if (people[i].id == p)
{
score = people[i].val;
rank = i + 1;
}
}
cout << score << " " << rank << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |