Submission #931384

# Submission time Handle Problem Language Result Execution time Memory
931384 2024-02-21T17:23:18 Z thisisadarsh Poi (IOI09_poi) C++14
0 / 100
500 ms 16152 KB
#include <bits/stdc++.h>
using namespace std;

bool comparePairs(const pair<int, int> &a, const pair<int, int> &b) {
    return a.first < b.first;
}

bool sortBySecond(const pair<int, int> &a, const pair<int, int> &b) {
    return a.second < b.second;
}


int main(){
	int N, T, P;
	cin >> N >> T >> P;
	vector<vector<int>> a(N, vector<int> (T,0));
	vector<int>score(T,0);
	for(int i = 0; i < N; i++){
		for(int j = 0; j < T; j++){
			cin >> a[i][j];
		}
	}	
	for(int i = 0; i < T; i++){
		for(int j = 0; j < N; j++){
			if(a[j][i] == 0){
				score[i]++;
			}
		}
	}
	vector<pair<int, int>>player_score(N);
	for(int i = 0; i < N; i++){
		player_score[i].second = i+1;
	}
	for(int i = 0; i < N; i++){
		for(int j = 0; j < T; j++){
			if(a[i][j] != 0){
				player_score[i].first += score[j];
			}
		}
	}
	sort(player_score.begin(), player_score.end(), comparePairs);
	bool ok = false;
	int pos = -1, s = 0;
	for(int i = 0; i < N; i++){
		if(player_score[i].second == P){
			if(i+1 < N && player_score[i+1].first == player_score[i].first){
				ok = true;
			}
			if(i-1 >= 0 && player_score[i-1].first == player_score[i].first){
				ok = true;
			}
			else{
				pos = i+1;
				s = player_score[i].first;
			}
		}
	}
	if(ok == false){
		cout << s << ' ' << pos << '\n';
		return 0;
	}

	sort(player_score.begin(), player_score.end(),  sortBySecond);
	for(int i = 0; i < N; i++){
		if(player_score[i].second == P){
			pos = i+1;
			s = player_score[i].first;
		}
	}
	cout << s << ' ' << pos << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 1 ms 460 KB Output isn't correct
9 Incorrect 2 ms 348 KB Output isn't correct
10 Incorrect 4 ms 344 KB Output isn't correct
11 Incorrect 15 ms 860 KB Output isn't correct
12 Incorrect 25 ms 1112 KB Output isn't correct
13 Incorrect 81 ms 2764 KB Output isn't correct
14 Incorrect 104 ms 3772 KB Output isn't correct
15 Incorrect 183 ms 6320 KB Output isn't correct
16 Incorrect 197 ms 6744 KB Output isn't correct
17 Incorrect 294 ms 9880 KB Output isn't correct
18 Incorrect 328 ms 11096 KB Output isn't correct
19 Incorrect 438 ms 14672 KB Output isn't correct
20 Incorrect 500 ms 16152 KB Output isn't correct