Submission #426976

#TimeUsernameProblemLanguageResultExecution timeMemory
426976DaktoWall (IOI14_wall)C++17
0 / 100
286 ms25648 KiB
#include "wall.h" #include <bits/stdc++.h> using namespace std; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ map<int,vector<int>> beg,end; set<int> low,high; for(int i=0; i<k; i++){ beg[left[i]].push_back(i); end[right[i]+1].push_back(i); } for(int i=0; i<n; i++){ for(auto j:beg[i]){ if(op[j]==1) low.insert(height[j]); else high.insert(height[j]); } for(auto j:end[i]){ if(op[j]==1) low.erase(low.find(height[j])); else high.erase(high.find(height[j])); } finalHeight[i]=min(low.empty()?0:*next(low.end(),-1), high.empty()?1000000:*(high.begin())); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...