Submission #113971

#TimeUsernameProblemLanguageResultExecution timeMemory
113971E869120Wall (IOI14_wall)C++14
8 / 100
3090 ms26104 KiB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;

int N, Q, ty[1 << 21], L[1 << 21], R[1 << 21], H[1 << 21], A[1 << 21];

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
	N = n; Q = k;
	for (int i = 1; i <= Q; i++) { ty[i] = op[i - 1]; L[i] = left[i - 1]; R[i] = right[i - 1]; H[i] = height[i - 1]; }
	
	for (int i = 1; i <= Q; i++) {
		if (ty[i] == 1) {
			for (int j = L[i]; j <= R[i]; j++) A[j] = max(A[j], H[i]);
		}
		if (ty[i] == 2) {
			for (int j = L[i]; j <= R[i]; j++) A[j] = min(A[j], H[i]);
		}
	}
	for (int i = 0; i < N; i++) finalHeight[i] = A[i];
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...