Submission #322015

# Submission time Handle Problem Language Result Execution time Memory
322015 2020-11-13T18:10:45 Z aaronhma Poi (IOI09_poi) C++17
70 / 100
353 ms 8940 KB
#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
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 0 ms 364 KB Output isn't correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 4 ms 364 KB Output is correct
11 Correct 11 ms 620 KB Output is correct
12 Correct 19 ms 876 KB Output is correct
13 Incorrect 53 ms 1644 KB Output isn't correct
14 Correct 75 ms 2304 KB Output is correct
15 Incorrect 133 ms 3564 KB Output isn't correct
16 Correct 143 ms 3820 KB Output is correct
17 Correct 210 ms 5484 KB Output is correct
18 Correct 239 ms 6124 KB Output is correct
19 Correct 314 ms 8172 KB Output is correct
20 Correct 353 ms 8940 KB Output is correct