답안 #222349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222349 2020-04-13T05:05:53 Z errorgorn ACM (COCI19_acm) C++14
50 / 50
9 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ll,ii>
#define endl '\n'

struct dat{
	string name;
	int first,second;
	
	dat(string _name,int _f,int _s){
		name=_name;
		first=_f;
		second=_s;
	}
};

int n,m;
string s;
vector<dat> v;

dat add(dat i,dat j){
	return dat(i.name,i.first+j.first,i.second+j.second);
}

dat parse(string s){
	if (s.size()<=2) return dat("",0,0);
	else{
		int time=(s[1]-'1')*1200; //time in seconds??
		
		time+=(s[3]-'0')*36000;
		time+=(s[4]-'0')*3600;
		
		time+=(s[6]-'0')*600;
		time+=(s[7]-'0')*60;
		
		time+=(s[9]-'0')*10;
		time+=(s[10]-'0');
		
		return dat("",1,time);
	}
}

int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	
	cin>>n>>m;
	
	while (n--){
		cin>>s; //trash
		
		v.push_back(dat(s,0,0));
		
		for (int x=0;x<m;x++){
			cin>>s;
			v.back()=add(v.back(),parse(s));
		}
		
		if (v.back().name=="NijeZivotJedanACM") v.pop_back();
	}
	
	cin>>s;
	
	dat res=dat(s,0,0);
	for (int x=0;x<m;x++){
		cin>>s;
		res=add(res,parse(s));
	}
	
	//cout<<"res: "<<res.first<<" "<<res.second<<endl;
	
	int ans=0;
	
	for (auto &it:v){
		//cout<<it.first<<" "<<it.second<<endl;
		
		if (it.first>res.first) ans++;
		else if (it.first==res.first && it.second<res.second) ans++;
		else if (it.first==res.first && it.second==res.second && it.name<res.name) ans++;
	}
	
	cout<<ans+1<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 9 ms 384 KB Output is correct