// written by Asedre
#include <iostream>
#include <cmath>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <numeric>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <cstring>
#include <unordered_map>
#define pb push_back
#define ll long long
#define ld long double
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define ull unsigned long long
using namespace std;
const int maxv = 1e6 + 3, maxn = 1e6 + 12, LOG = 25;
const ll inf = 1e18 + 5;
const int MOD = 1e9 + 7, MOD2 = 1338519349;
const double PI = 3.14159265359;
//prime nums: 9059, 5419, 3571
void teztez( ) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}/*
ll binpow(ll x, ll p, ll mod) {
if (!p) return 1;
if (p % 2) return (x % mod * binpow(x, p - 1, mod)) % mod;
ll xx = binpow(x, p / 2, mod);
return (xx % mod * xx % mod) % mod;
}
*/
ll binpow(ll x, ll p) {
if (!p) return 1;
if (p % 2) return (x % MOD * binpow(x, p - 1) % MOD) % MOD;
ll xx = binpow(x, p / 2) % MOD;
return (xx * xx) % MOD;
}
ll gcd(ll a,ll b) {
return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
return abs(a * b) / gcd(a, b);
}
struct datta {
int sec, p1, p2;
} a[maxv];
bool comp(datta a, datta b) {
if (a.sec != b.sec) return a.sec < b.sec;
return a.p1 < b.p1;
}
void solve( ) {
int n;
cin >> n;
for (int i = 1; i <= n; i ++) {
cin >> a[i].sec >> a[i].p1 >> a[i].p2;
}
sort(a + 1, a + 1 + n, comp);
int tm1 = 0, tm2 = 0;
set <int> t1, t2;
for (int i = 1; i <= n; i ++) {
if (t1.empty( )) {
t1.insert(a[i].p1);
tm1 += 100;
continue;
}
if (t1.find(a[i].p2) != t1.end( )) {
t2.insert(a[i].p1);
tm2 += 100;
if (i > 1 and a[i - 1].p1 == a[i].p1 and a[i].sec - a[i - 1].sec <= 10) tm2 += 50;
}
else {
t1.insert(a[i].p1);
t2.insert(a[i].p2);
tm1 += 100;
if (i > 1 and a[i - 1].p1 == a[i].p1 and a[i].sec - a[i - 1].sec <= 10) tm1 += 50;
}
}
cout << tm1 << " " << tm2;
}
signed main( ) {
teztez( );
//freopen("angle2.in", "r", stdin); freopen("angle2.out", "w", stdout);
int testcases = 1;
//cin >> testcases;
while (testcases--) {
solve( );
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |