답안 #245222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245222 2020-07-05T18:32:56 Z penguinhacker ACM (COCI19_acm) C++14
10 / 50
8 ms 512 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});
	}
	//for (auto x : team)
	//	cout << x.first.first << ' ' << x.first.second << ' ' << x.second << '\n';
	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
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 512 KB Output is correct
2 Incorrect 8 ms 384 KB Output isn't correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Incorrect 7 ms 384 KB Output isn't correct
5 Incorrect 7 ms 384 KB Output isn't correct