제출 #581429

#제출 시각아이디문제언어결과실행 시간메모리
581429kamelfanger83벽 (IOI14_wall)C++14
0 / 100
1 ms212 KiB
#include <iostream> #include <vector> #include "wall.h" #include <set> using namespace std; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ /*if(n <= 10000 && k <= 5000){ vector<int> heightl (n, 0); for(int update = 0; update < k; update++){ for(int setter = left[update]; setter <= right[update]; setter++){ if(op[update] == 1) heightl[setter] = max(heightl[setter], height[update]); else heightl[setter] = min(heightl[setter], height[update]); } } for(int finisher = 0; finisher < n; finisher++) finalHeight[finisher] = heightl[finisher]; } else{*/ vector<vector<int>> adds (n); vector<vector<int>> adde (n+1); vector<vector<int>> subs (n); vector<vector<int>> sube (n+1); for(int update = 0; update < k; update++){ if(op[update] == 1){ adds[left[update]].push_back(height[update]); adde[right[update]+1].push_back(height[update]); } else{ subs[left[update]].push_back(height[update]); sube[right[update]+1].push_back(height[update]); } } vector<int> mad (n, 0); multiset<int, greater<>> b; for(int madder = 0; madder < n; madder++){ for(int ins : adds[madder]) b.insert(ins); for(int rm : adde[madder]) b.erase(rm); mad[madder] = *(b.begin()); } vector<int> msu (n, 0); multiset<int> s; for(int madder = 0; madder < n; madder++){ for(int ins : subs[madder]) s.insert(ins); for(int rm : sube[madder]) s.erase(rm); msu[madder] = *(s.begin()); } for(int finisher = 0; finisher < n; finisher++) finalHeight[finisher] = min(mad[finisher], msu[finisher]); //} }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...