Submission #588000

#TimeUsernameProblemLanguageResultExecution timeMemory
588000FatihSolakWall (IOI14_wall)C++17
8 / 100
3098 ms18676 KiB
#include "wall.h" #include <bits/stdc++.h> #define N 100005 using namespace std; vector<int> st[N]; vector<int> nd[N]; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for(int i = 0;i<n;i++){ finalHeight[i] = 0; } if(n * k <= 1e8){ for(int i = 0;i<k;i++){ for(int j = left[i];j<=right[i];j++){ if(op[i] == 1){ finalHeight[j] = max(finalHeight[j],height[i]); } else{ finalHeight[j] = min(finalHeight[j],height[i]); } } } } else{ multiset<int> maxs = {0}; multiset<int> mins = {(int)1e9}; for(int i = 0;i<k;i++){ st[left[i]].push_back(i); nd[right[i] + 1].push_back(i); } for(int i = 0;i<n;i++){ for(auto u:st[i]){ if(op[u] == 1){ maxs.insert(height[u]); } else{ mins.insert(height[u]); } } for(auto u:nd[i]){ if(op[u] == 1){ maxs.erase(maxs.find(height[u])); } else{ mins.erase(mins.find(height[u])); } } finalHeight[i] = min(*maxs.rbegin(),*mins.begin()); } } 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...