Submission #484016

# Submission time Handle Problem Language Result Execution time Memory
484016 2021-11-01T22:46:27 Z CSQ31 ACM (COCI19_acm) C++17
50 / 50
5 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fi first
#define se second
struct team{
	string name;
	ll ac = 0,pen = 0;
	team(){}
};
bool cmp(const team &a,const team &b){
	if(a.ac!=b.ac)return a.ac > b.ac;
	if(a.pen!=b.pen)return a.pen < b.pen;
	return a.name < b.name;
}
int main()
{
	int n,m;
	cin>>n>>m;
	vector<team>fuck;
	string ahhh = "NijeZivotJedanACM";
	for(int i=0;i<=n;i++){
		team f;
		cin>>f.name;
		for(int i=0;i<m;i++){
			string s;
			cin>>s;
			if((int)(s.size())<=2)continue;
			if(s[0] != '-'){
				f.ac++;
				//NijeZivotJedanACM ?1/04:42:43 -
				f.pen += (s[1] - '1') * 60 * 20;
				f.pen += (s[3] - '0') * 60 * 10 * 60;
				f.pen += (s[4] - '0') * 60 * 60;
				
				f.pen += (s[6] - '0') * 10 * 60;
				f.pen += (s[7] - '0') * 60;
				
				f.pen += (s[9] - '0') * 10;
				f.pen += (s[10] - '0');
			}
			
		}
		//cout<<f.ac<<" "<<f.pen<<'\n';
		if(i!=n && f.name == ahhh)continue;
		fuck.push_back(f);
	}
	sort(fuck.begin(),fuck.end(),cmp);
	for(int i=0;i<n;i++){
		if(fuck[i].name == ahhh){
			cout<<i+1;
			return 0;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 5 ms 408 KB Output is correct
5 Correct 5 ms 460 KB Output is correct