답안 #245220

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245220 2020-07-05T18:24:24 Z penguinhacker ACM (COCI19_acm) C++17
0 / 50
8 ms 616 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(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
*/

Compilation message

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from acm.cpp:2:
acm.cpp: In function 'int main()':
acm.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(team.size()==n);
         ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Incorrect 7 ms 512 KB Output isn't correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Incorrect 7 ms 512 KB Output isn't correct
5 Incorrect 8 ms 616 KB Output isn't correct