Submission #428105

#TimeUsernameProblemLanguageResultExecution timeMemory
428105Rouge_HugoWall (IOI14_wall)C++14
0 / 100
831 ms33904 KiB
#include<bits/stdc++.h> #include "wall.h" #define ll long long #define fi first #define se second #define pb push_back using namespace std; const int N=100090; vector<int>v[N],vv[N]; multiset<int>s; void buildWall(int n, int k, int op[], int l[], int r[], int h[], int a[]){ for(int i=0;i<k;i++) { if(op[i]==2)break; v[l[i]].pb(h[i]); vv[r[i]].pb(h[i]); } s.insert(0); for(int i=0;i<n;i++) { for(auto it:v[i]) s.insert(it); int x=*s.rbegin(); a[i]=max(a[i],x); for(auto it:vv[i]) s.erase(it); } s.clear(); s.insert(1e9); for(int i=0;i<n+1;i++){ v[i].clear(); vv[i].clear(); } for(int i=0;i<k;i++) { if(op[i]==1)continue; v[l[i]].pb(h[i]); vv[r[i]].pb(h[i]); } for(int i=0;i<n;i++) { for(auto it:v[i]) s.insert(it); int x=*s.begin(); a[i]=min(a[i],x); for(auto it:vv[i]) s.erase(it); } return; } /* 4 2 1 1 3 3 2 3 4 1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...