# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1117209 | vjudge1 | 사다리꼴 (balkan11_trapezoid) | C++17 | 242 ms | 27208 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |