Submission #711634

# Submission time Handle Problem Language Result Execution time Memory
711634 2023-03-17T10:07:42 Z william950615 ACM (COCI19_acm) C++14
50 / 50
10 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define MEM(x) memset(x, 0, sizeof(x))
#define ALL(x) begin(x), end(x)
#define REP(i,n,...) for( int i = 0, ##__VA_ARGS__; i < n; ++i )
#define FOR(i,a,b,...) for( int i = (a), ##__VA_ARGS__; i <=(b); ++i)
#define RFOR(i,a,b,...) for( int i = (a), ##__VA_ARGS__; i >=(b); --i)
#define SZ(x) int(x.size())
#define EB emplace_back
#define EP emplace


//#define DEBUG
#ifdef DEBUG
	template<typename T> void _DO(T&&x) {cerr << x<< '\n';}
	template<typename A, typename ...B> void _DO(A&&a, B&&...b) {
		cerr <<a << ',';
		_DO(b...);
	}
	#define de(...) do{\
		fprintf(stderr, "%s-%d (%s):", __func__, __LINE__, #__VA_ARGS__);\
		_DO(__VA_ARGS__);\
	}while(0);
#else
	#define de(...)
#endif
typedef long long ll;
typedef pair<int,int> pii;
template<typename T>
using V = vector<T>;


constexpr int penalty = 1200;

struct Team {
	string name;
	int val;
	int penalty;
	Team( string _name, int _val, int _penalty ) {
		name = _name;	
		val = _val;
		penalty = _penalty;
	};
};

int TimeTrans( int H, int M, int S ) {
	return H*3600 + M*60 + S;
}


inline void solve() {
	int N, M; cin >> N >> M;
	V<Team> t;
	FOR(i,0,N) {
		string name;
		cin >> name;
		//de(name);
		int pen = 0;
		int acproblem = 0;
		de( name, i, M );
		REP(j,M) {
			char status;
			int cnt, h, m, s;
			char tmp;
			cin >> status; 
			if( status != '-' ) {
				cin >> cnt >> tmp >> h >> tmp >> m  >> tmp >> s;
				//de( status, cnt, h, m, s );
				pen += ((cnt-1) * penalty) + TimeTrans( h, m, s );
				acproblem++;
			}
			else {
				getchar();
			}
		}
		//de( name, penalty, acproblem );
		if( name == "NijeZivotJedanACM" && i != N ) {
			continue;
		}
		t.EB( name,acproblem, pen);
	}
	sort( ALL(t), [&](Team &a, Team &b ) {
			return ( a.val > b.val || ( a.val == b.val && a.penalty < b.penalty ) || ( a.val == b.val && a.penalty == b.penalty && a.name < b.name ));
			});
	for( int i = 0; i < SZ(t); ++i ) {
		de(i, t[i].name, t[i].val, t[i].penalty );
		if( t[ i ].name == "NijeZivotJedanACM" ) {
			cout << i+1 << '\n';
		}
	}
}
int main () {
	int T = 1; 
#ifdef Local
	cin >> T;
#endif 
	while(T--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 9 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 9 ms 308 KB Output is correct
5 Correct 10 ms 376 KB Output is correct