diff --git "a/Seol-JY/202510/19 BOJ G5 \355\203\234\354\203\201\354\235\264\354\235\230 \355\233\210\353\240\250\354\206\214 \354\203\235\355\231\234.md\342\200\216" "b/Seol-JY/202510/19 BOJ G5 \355\203\234\354\203\201\354\235\264\354\235\230 \355\233\210\353\240\250\354\206\214 \354\203\235\355\231\234.md\342\200\216" new file mode 100644 index 00000000..4b4ccd9c --- /dev/null +++ "b/Seol-JY/202510/19 BOJ G5 \355\203\234\354\203\201\354\235\264\354\235\230 \355\233\210\353\240\250\354\206\214 \354\203\235\355\231\234.md\342\200\216" @@ -0,0 +1,44 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + int N = nextInt(st); + int M = nextInt(st); + + int[] height = new int[N + 1]; + st = new StringTokenizer(br.readLine()); + for (int i = 1; i <= N; i++) { + height[i] = nextInt(st); + } + + int[] diff = new int[N + 2]; + for (int i = 0; i < M; i++) { + st = new StringTokenizer(br.readLine()); + int a = nextInt(st); + int b = nextInt(st); + int k = nextInt(st); + + diff[a] += k; + diff[b + 1] -= k; + } + + StringBuilder sb = new StringBuilder(); + int cumSum = 0; + for (int i = 1; i <= N; i++) { + cumSum += diff[i]; + sb.append(height[i] + cumSum).append(' '); + } + + System.out.println(sb); + } + + static int nextInt(StringTokenizer st) { + return Integer.parseInt(st.nextToken()); + } +} +```