Submission #754141

# Submission time Handle Problem Language Result Execution time Memory
754141 2023-06-07T01:57:46 Z vjudge1 Poi (IOI09_poi) C++17
0 / 100
225 ms 15984 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;

bool comparator(pair<int, pair<int, int>> &a, pair<int, pair<int, int>> &b) {
	if(a.se.se == a.se.se) {
		if(a.se.fi == a.se.fi) return a.fi < b.fi;
		else return a.se.fi > b.se.fi;
	}
	else return a.se.se > b.se.se;
}

int main() {
	ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

	int n, t, p;
	cin >> n >> t >> p;
	p-=1;

	// input & data nilai 0 (nilai tambah)
	int nilai[n][t], skortempo[t];
	memset(skortempo, 0, sizeof(skortempo));
	for(int i=0; i<n; i++) {
		for(int j=0; j<t; j++) {
			cin >> nilai[i][j];
			if(nilai[i][j] == 0) skortempo[j]++;
		}
	}

	pair <int, pair <int, int>> data[n]; // id, (solved task count, nilai total)
	for(int i=0; i<n; i++) {
		data[i].fi = i;
		data[i].se.fi = 0;
		data[i].se.se = 0;
		for(int j=0; j<t; j++) {
			if(nilai[i][j] != 0) {
				data[i].se.se += skortempo[j];
				data[i].se.fi++;
			}
		}
	}

	sort(data, data+n, comparator);

	for(int i=0; i<n; i++) {
		if(data[i].fi == p) {
			cout << data[i].se.se << " " << i+1;
			break; 
		}
	}
}

Compilation message

poi.cpp: In function 'bool comparator(std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)':
poi.cpp:9:13: warning: self-comparison always evaluates to true [-Wtautological-compare]
    9 |  if(a.se.se == a.se.se) {
      |             ^~
poi.cpp:10:14: warning: self-comparison always evaluates to true [-Wtautological-compare]
   10 |   if(a.se.fi == a.se.fi) return a.fi < b.fi;
      |              ^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Incorrect 1 ms 340 KB Output isn't correct
8 Incorrect 1 ms 340 KB Output isn't correct
9 Incorrect 1 ms 340 KB Output isn't correct
10 Incorrect 3 ms 436 KB Output isn't correct
11 Incorrect 7 ms 784 KB Output isn't correct
12 Incorrect 16 ms 980 KB Output isn't correct
13 Incorrect 35 ms 2636 KB Output isn't correct
14 Incorrect 49 ms 3628 KB Output isn't correct
15 Incorrect 82 ms 6184 KB Output isn't correct
16 Incorrect 92 ms 6664 KB Output isn't correct
17 Incorrect 139 ms 9620 KB Output isn't correct
18 Incorrect 186 ms 10964 KB Output isn't correct
19 Incorrect 199 ms 14412 KB Output isn't correct
20 Incorrect 225 ms 15984 KB Output isn't correct