# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117209 | vjudge1 | trapezoid (balkan11_trapezoid) | C++17 | 242 ms | 27208 KiB |
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;
#define F first
#define S second
pair<int,int> operator+=(pair<int,int> &a,pair<int,int> b){
if(a.F<b.F)
return a=b;
if(a.F>b.F)
return a;
a.S+=b.S;
if(a.S>=30013)
a.S-=30013;
return a;
}
struct {
pair<int,int> trrre[200100];
pair<int,int>query(int x){
pair<int,int>res;
while(x)
res+=trrre[x],x-=x&-x;
return res;
}
void upd(int x,pair<int,int> c){
c.first++;
while(x<=2e5)
trrre[x]+=c,x+=x&-x;
}
} fenwick;
pair<int,int> vals[100100];
map<int,int>mp2;
map<int,array<int,3>>mp1;
int CC;
int main(){
cin.tie(0)->sync_with_stdio(0);
int n;
cin>>n;
for(int i=1;i<=n;i++){
int a,b,c,d;
cin>>a>>b>>c>>d;
mp2[a],mp2[b];
mp1[c]={a,0,i};
mp1[d]={b,1,i};
}
fenwick.upd(1,{0,1});
for(auto&[i,j]:mp2)
j=++CC;
for(auto[i,j]:mp1){
auto[pos,op,ind]=j;
pos=mp2[pos];
if(op) fenwick.upd(pos,vals[ind]);
else vals[ind]=fenwick.query(pos);
}
pair<int,int>X = fenwick.query(mp2.size());
cout<<X.F-1<<' '<<X.S<<'\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |