Submission #245221

# Submission time Handle Problem Language Result Execution time Memory
245221 2020-07-05T18:25:09 Z penguinhacker ACM (COCI19_acm) C++17
0 / 50
8 ms 384 KB
//ACM
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int n, m;
vector<pair<pair<int, int>, string>> team;

void re(pair<int, int> &p) {
	string t;
	cin >> t;
	if (t[0]=='-')
		return;
	++p.first;
	p.second+=t[1]-'1';
}

bool srt(pair<pair<int, int>, string> a, pair<pair<int, int>, string> b) {
	assert(a.second!=b.second);
	if (a.first.first!=b.first.first) return a.first.first<b.first.first;
	if (a.first.second!=b.first.second) return a.first.second<b.first.second;
	return a.second<b.second;
}

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

	cin >> n >> m;
	for (int i=0; i<=n; ++i) {
		string name;
		cin >> name;
		pair<int, int> p={0, 0};
		for (int j=0; j<m; ++j) {
			re(p);
		}
		if (i<n&&name=="NijeZivotJedanACM")
			continue;
		team.push_back({p, name});
	}
	assert((int)team.size()==n);
	sort(team.begin(), team.end(), srt);
	for (int i=0; i<n; ++i) {
		if (team[i].second=="NijeZivotJedanACM") {
			cout << i+1;
			break;
		}
	}
	return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Incorrect 7 ms 384 KB Output isn't correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Incorrect 8 ms 384 KB Output isn't correct
5 Incorrect 7 ms 384 KB Output isn't correct