Submission #222277

#TimeUsernameProblemLanguageResultExecution timeMemory
222277MODDIWall (IOI14_wall)C++14
8 / 100
3084 ms18296 KiB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX = 2000000;
vector<int> arr;
void update(int l, int r, int h, int type){
	for(int i = l; i <= r; i++){
		if(type == 1)
			arr[i] = max(arr[i], h);
		else
			arr[i] = min(arr[i], h);
	}
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
	arr.assign(n, 0);
	for(int i = 0; i < k; i++){
		int type = op[i];
		int l = left[i], r = right[i], h = height[i];
		if(type == 1)
			update(l, r, h, 1);
		else
			update(l,r,h,2);
	}
	for(int i = 0; i < n; i++){
		//cout<<arr[i]<<" ";
		finalHeight[i] = arr[i];
	}
}
/*int main()
{
	int n, k;
	cin>>n>>k;
	int op[k], left[k], right[k], height[k], finalHeight[n];
	for(int i = 0; i <k; i++){
		cin>>op[i]>>left[i]>>right[i]>>height[i];
	}
	buildWall(n, k, op, left, right, height, finalHeight);
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...