답안 #229222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
229222 2020-05-03T21:12:19 Z VEGAnn ACM (COCI19_acm) C++14
50 / 50
6 ms 640 KB
#include <bits/stdc++.h>
#define MP make_pair
#define MP3(a, b, c) MP(MP(a, b), c)
#define PB push_back
#define all(x) x.begin(),x.end()
#define pii pair<int, int>
#define piis pair<pii, string>
#define ft first
#define sd second
using namespace std;
string s;
vector<piis> vc;
int n, m;

int main(){
	
	ios_base::sync_with_stdio(0); cin.tie(0);
	
//	freopen("in.txt","r",stdin);
	
	cin >> n >> m;
	
	for (int i = 0; i < n; i++){
		cin >> s;
		
		int tim = 0, kol = 0;
		
		for (int i = 0; i < m; i++){
			string s; cin >> s;
			
			if (s[0] == '-') continue;
			
			int pos = s.find('/');
			
			tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0')) * 60 * 60;
			pos += 3;
			
			tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0')) * 60;
			pos += 3;
			
			tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0'));
			pos += 3;
			
			tim += (s[1] - '0') * 20 * 60;
			
			kol++;
			
		}
		
		if (s != "NijeZivotJedanACM")
			vc.PB(MP3(-kol, tim, s));
	}
	
	cin >> s;
	
	int tim = 0, kol = 0;
		
	for (int i = 0; i < m; i++){
		string s; cin >> s;
			
		if (s[0] == '-') continue;
		
		int pos = s.find('/');
		
		tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0')) * 60 * 60;
		pos += 3;
		
		tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0')) * 60;
		pos += 3;
		
		tim += ((s[pos + 1] - '0') * 10 + (s[pos + 2] - '0'));
		pos += 3;
		
		tim += (s[1] - '0') * 20 * 60;
		
		kol++;
	}
	
	vc.PB(MP3(-kol, tim, s));
	
	sort(all(vc));
	
	int nm = 0;
	
	while (vc[nm].sd != "NijeZivotJedanACM")
		nm++;
	
	cout << nm + 1;
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 6 ms 640 KB Output is correct