This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
signed main(){
int n;cin>>n;
vector<vector<long long>> v;
for(int i = 0;i<n;i++){
long long a,b,c;cin>>a>>b>>c;
v.push_back({a,b,c});
}
sort(v.begin(),v.end());
long long sum1 = 0 , sum2 = 0;
queue<long long> q[10];
for(auto i:v){
if((i[1]<=4)^(i[2]<=4)){
if(i[1]<=4)sum1+=100;
else sum2+=100;
while(!q[i[1]].empty()&&i[0]-q[i[1]].front()>10)q[i[1]].pop();
long long sz = q[i[1]].size();
if(i[1]<=4)sum1+=sz*50;
else sum2+=sz*50;
while(q[i[1]].size())q[i[1]].pop();
q[i[1]].push(i[0]);
}
}
cout<<sum1<<" "<<sum2<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |