#include <stdio.h>

int main() {
    //n 배열 크기, m 반복횟수
    int n,m,ball[100]={0};
    //s 시작, e 끝 
    int s,e,ball_n;
    scanf("%d %d",&n,&m);
    for (int i=0; i<m; i++) {
        scanf("%d %d %d",&s,&e,&ball_n);
        for (int j=s-1; j<e;  j++) {
            ball[j]=ball_n;
        }
    }
    for(int i=0; i<n; i++){
        printf("%d ",ball[i]);
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: