//
// main.cpp
// sorting
//
// Created by Team SSG on 30/10/21.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
struct Player {
int score;
int numberOfProblemSolved;
};
bool mapComparator(pair<int, Player> &a, pair<int, Player> &b) {
if (a.second.score > b.second.score) return true;
else if (a.second.score < b.second.score) return false;
if (a.second.numberOfProblemSolved > b.second.numberOfProblemSolved) return true;
else if (a.second.numberOfProblemSolved < b.second.numberOfProblemSolved) return false;
return a.first < b.first;
}
vector<pair<int, Player>> sort(map<int, Player> &userScores) {
vector<pair<int, Player>> temp;
for (auto& it : userScores) {
temp.push_back(it);
}
sort(temp.begin(), temp.end(), mapComparator);
return temp;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int N, T, P;
cin >> N >> T >> P;
vector<vector<int>> tasks(N, vector<int>(T));
map<int, int> taskScores;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < T; ++j) {
cin >> tasks[i][j];
if (tasks[i][j] == 0) {
taskScores[j] += 1;
}
}
}
map<int, Player> userScores;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < T; ++j) {
if (tasks[i][j] == 1) {
userScores[i].score += taskScores[j];
userScores[i].numberOfProblemSolved++;
}
}
}
vector<pair<int, Player>> sortedPlayer = sort(userScores);
int targetId = -1;
for (auto& it : sortedPlayer) {
if (it.first == P) {
targetId = it.first;
break;
}
}
cout << sortedPlayer[targetId].second.score << ' ' << sortedPlayer[targetId].first << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
460 KB |
Output isn't correct |
11 |
Incorrect |
14 ms |
812 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
1136 KB |
Output isn't correct |
13 |
Incorrect |
72 ms |
2692 KB |
Output isn't correct |
14 |
Incorrect |
110 ms |
3692 KB |
Output isn't correct |
15 |
Incorrect |
186 ms |
6260 KB |
Output isn't correct |
16 |
Incorrect |
207 ms |
6768 KB |
Output isn't correct |
17 |
Incorrect |
303 ms |
9944 KB |
Output isn't correct |
18 |
Incorrect |
358 ms |
11360 KB |
Output isn't correct |
19 |
Incorrect |
485 ms |
14756 KB |
Output isn't correct |
20 |
Incorrect |
535 ms |
16256 KB |
Output isn't correct |