제출 #204579

#제출 시각아이디문제언어결과실행 시간메모리
204579awlintqaa벽 (IOI14_wall)C++14
32 / 100
1192 ms40072 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 200 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; const ll mod=1e9+7; const ll inf= 4e18; const ld pai=acos(-1); #include "wall.h" int n,q; vi MX[100009][2],MN[100009][2]; int mx[100009],mn[100009]; void buildWall(int N, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ n=N,q=k; for(int i=0;i<n;i++)finalHeight[i]=0; if(n<=1e4 && q<=5e3){ for(int i=0;i<q;i++){ int t=op[i]; int l=left[i]; int r=right[i]; int h=height[i]; for(int j=l;j<=r;j++){ if(t==1){ finalHeight[j]=max(finalHeight[j],h); } if(t==2){ finalHeight[j]=min(finalHeight[j],h); } } } return ; } for(int i=0;i<q;i++){ int t=op[i]; int l=left[i]; int r=right[i]; int h=height[i]; if(t==1){ MX[l][0].pb(h); MX[r][1].pb(h); } if(t==2){ MN[l][0].pb(h); MN[r][1].pb(h); } } mset<int>s; for(int i=0;i<n;i++)mn[i]=1e9; for(int i=0;i<n;i++){ for(auto u:MX[i][0])s.ins(u); if(s.size())mx[i]=*s.rbegin(); for(auto u:MX[i][1])s.era(s.find(u)); } s.clear(); for(int i=0;i<n;i++){ for(auto u:MN[i][0])s.ins(u); if(s.size())mn[i]=*s.begin(); for(auto u:MN[i][1])s.era(s.find(u)); } for(int i=0;i<n;i++){ if(mn[i]<mx[i]){ finalHeight[i]=mn[i]; } else{ finalHeight[i]=mx[i]; } } return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...