제출 #237872

#제출 시각아이디문제언어결과실행 시간메모리
237872FashoWall (IOI14_wall)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> #define N 1000005 #define ll long long int #define MP make_pair #define pb push_back #define ppb pop_back #define sp " " #define endl "\n" #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout); #define mod 1000000007 #define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i] #define fo(i,x,y) for(ll i=x;i<=y;i++) #define INF 1000000000005 #define ull unsigned long long int using namespace std; ll n,m,ar[N],sum,t,tree[6*N]; lli lazy[N]; void push(ll ind,int l,int r) { if(lazy[ind].se==1) tree[ind]=max(tree[ind],lazy[ind].fi); if(lazy[ind].se==2) tree[ind]=min(tree[ind],lazy[ind].fi); if(l!=r) { int mid=(l+r)/2; push(ind*2,l,mid); push(ind*2+1,mid+1,r); lazy[ind*2]=lazy[ind]; lazy[ind*2+1]=lazy[ind]; } lazy[ind]={0,0}; } ll query(int ind,int l,int r,int a) { if(l>a || r<a) return 0; if(l==r) return a; int mid=(l+r)/2; if(mid<=a) return query(ind*2,l,mid,a); return query(ind*2+1,mid+1,r,a); } void upd(int ind,int l,int r,int a,int b,ll x,int typ) { if(l>b || r<a) return; push(ind,l,r); if(l>=a && r<=b) { lazy[ind]={x,typ}; push(ind,l,r); return; } int mid=(l+r)/2; upd(ind*2,l,mid,a,b,x,typ); upd(ind*2+1,mid+1,r,a,b,x,typ); return; } // void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ fo(i,0,k-1) upd(1,1,n,left[i]+1,right[i]+1,height[i],op[i]); fo(i,0,n-1) finalHeight[i]=query(1,1,n,i); return; } // int main() // { // fast; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...