제출 #1146835

#제출 시각아이디문제언어결과실행 시간메모리
1146835gulmixLjeto (COCI21_ljeto)C++20
50 / 50
0 ms328 KiB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

struct team{
    ll t, a, b;
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //ifstream cin("cycle2.in");
    //ofstream cout("cycle2.out");
    ll n; cin >> n;
    vector<team> x;
    for(int i = 0; i < n; i++){
        ll t, a, b; cin >> t >> a >> b;
        x.push_back({t, a, b});
    }
    sort(all(x), [&](team &a, team &b){
        return a.t < b.t;
    });
    ll l = 0;
    ll cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < n; i++){
        while(x[i].t > x[l].t + 10){
            l++;
        }
        if(x[i].a <= 4){
            cnt1 += 100;
            for(int j = l; j < i; j++){
                if(x[j].a == x[i].a){
                    cnt1 += 50;
                    break;
                }
            }
        }
        if(x[i].a > 4){
            cnt2 += 100;
            for(int j = l; j < i; j++){
                if(x[j].a == x[i].a){
                    cnt2 += 50;
                    break;
                }
            }
        }
    }
    cout << cnt1 << ' ' << cnt2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...