Submission

Status:

[PPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Whatthepoop

Problemset: ภูเขา

Language: c

Time: 0.002 second

Submitted On: 2025-10-10 10:23:29

#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	int h[n];
	
	int max= -1e9, sum = 0;
	for(int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		if(h[i] > max) max = h[i];
		sum += h[i]*2;
	}
	
	int row = max, col = sum;
	char arr[row][col];
	
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			arr[i][j] = '.';
		}
	}
	
	int i = row-1, j = 0;
	for(int x = 0; x < n; x++){
		int count = h[x]*2;
		while(count > 0){
			if(count > h[x]){
				arr[i--][j++] = '/';
				count--;
				if(count == h[x]) i++;
			}
			else{
				arr[i++][j++] = '\\';
				count--;
			}
		}
		i = row-1;
	}
	
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			printf("%c", arr[i][j]);
		}
		printf("\n");
	}
	
	return 0;
}