Submission #1305074

#TimeUsernameProblemLanguageResultExecution timeMemory
1305074muhammad-ahmadLjeto (COCI21_ljeto)C++20
50 / 50
1 ms576 KiB
// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <set>
#include <deque>
#include <numeric>
#include <stack>
#include <chrono>
using namespace std;

void fast_io(){
	// freopen("", "r", stdin);
	// freopen("", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(); cout.tie();
	cout << setprecision(9);
}

#define int long long
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second

void solve() {
	int n; cin >> n;
	vector<pair<int, int>> A, B;
	for (int i = 1; i <= n; i++){
		int t, a, b; cin >> t >> a >> b;
		if (a <= 4) A.push_back({t, a});
		else B.push_back({t, a});
	}
	sort(all(A));
	sort(all(B));
	int ansa = A.size() * 100, ansb = B.size() * 100;
	vector<int> lst = {0, -1, -1, -1, -1, -1, -1, -1, -1};
	for (auto [t, p] : A){
		if (lst[p] == -1){
			lst[p] = t;
		}
		else {
			if (t - lst[p] <= 10){
				ansa += 50;
			}
			lst[p] = t;
		}
	}
	for (auto [t, p] : B){
		if (lst[p] == -1){
			lst[p] = t;
		}
		else {
			if (t - lst[p] <= 10){
				ansb += 50;
			}
			lst[p] = t;
		}
	}
	cout << ansa << ' ' << ansb << endl;
}

signed main() {
    fast_io();
    srand(chrono::steady_clock::now().time_since_epoch().count());
    int tc = 1;
    // cin >> tc;
    while (tc--) solve();
    return 0;
}



#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...