Submission #711602

# Submission time Handle Problem Language Result Execution time Memory
711602 2023-03-17T09:40:27 Z willychan ACM (COCI19_acm) C++14
50 / 50
3 ms 468 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds


struct stand{
	int solved=0;
	int time=0;
	string name;
};


int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,m;cin>>n>>m;
	vector<stand> arr(n);
	int de = 0;
	for(int i=0;i<n;i++){
		cin>>arr[i].name;
		if(arr[i].name == "NijeZivotJedanACM"){
			de = i;
			for(int j=0;j<m;j++){
				string s;cin>>s;
			}
			continue;
		}
		for(int j=0;j<m;j++){
			string s;cin>>s;
			if(s[0]=='+' || s[0]=='?'){
				int tries = s[1]-'0';
				int times = (s[4]-'0')*3600 + 60*((s[6]-'0')*10+(s[7]-'0')) + ((s[9]-'0')*10+s[10]-'0');
				times+=(tries-1)*20*60;
				arr[i].solved++;
				arr[i].time+=times;
			}
		}
	}
	cin>>arr[de].name;
	for(int j=0;j<m;j++){
			string s;cin>>s;
			if(s[0]=='+' || s[0]=='?'){
				int tries = s[1]-'0';
				int times = (s[4]-'0')*3600 + 60*((s[6]-'0')*10+(s[7]-'0')) + ((s[9]-'0')*10+s[10]-'0');
				times+=(tries-1)*20*60;
				arr[de].solved++;
				arr[de].time+=times;
			}
	}
	sort(arr.begin(),arr.end(),[](const stand &a,const stand &b){return (a.solved==b.solved)?((a.time==b.time)?(a.name<b.name):(a.time<b.time)):(a.solved>b.solved);});
	for(int i=0;i<n;i++){
		if(arr[i].name=="NijeZivotJedanACM"){
			cout<<i+1<<"\n";
			return 0;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct