Home
Problem
Status
Contest
Workbook
User
Group
Forum
Register
Login
{"managingGroups":{},"author":"Himayu","updateTime":1688286471000,"title":" Matrix Operations","dislikeCnt":0,"content":"can anybody solve this problem \nthis is codefroces problem ---\u003e\nhttps://codeforces.com/gym/103427/problem/K\n\n\n\nmemory limit per test : 512 megabytes\ntime limit per test : 15 seconds\n\nGiven an n × n matrix where each element a_{i,j} (1 ≤ i, j ≤ n) in the matrix is 0 initailly, you are asked to successively perform n groups of operations on the matrix.\n\nFor each group of operations, you are given six parameters x, y, z_1, z_2, z_3 and z_4 and need to do the following operations in order:\n\nFind the maximum element among a_{i,j} (1 ≤ i \u003c x, 1 ≤ j \u003c y), denoted by w_1;\nFind the maximum element among a_{i,j} (1 ≤ i \u003c x, y ≤ j ≤ n), denoted by w_2;\nFind the maximum element among a_{i,j} (x ≤ i ≤ n, 1 ≤ j \u003c y), denoted by w_3;\nFind the maximum element among a_{i,j} (x ≤ i ≤ n, y ≤ j ≤ n), denoted by w_4;\nIncrease each element a_{i,j} (1 ≤ i \u003c x, 1 ≤ j \u003c y) by z_1;\nIncrease each element a_{i,j} (1 ≤ i \u003c x, y ≤ j ≤ n) by z_2;\nIncrease each element a_{i,j} (x ≤ i ≤ n, 1 ≤ j \u003c y) by z_3;\nIncrease each element a_{i,j} (x ≤ i ≤ n, y ≤ j ≤ n) by z_4.\nAfter performing each group of operations, you need to output the values of w_1, w_2, w_3 and w_4.\n\nInput\n\nThe first line contains an integer n (2 ≤ n ≤ 10^5), indicating the number of rows as well as columns in the matrix as well as the number of groups of operations.\n\nThen follow n lines, each of which contains contains six integers x, y (1 \u003c x, y ≤ n), z_1, z_2, z_3 and z_4 (1≤ z_1, z_2, z_3, z_4≤ 10^9), indicating the parameters of a group of operations as described above.\n\nOutput\n\nFor each operation, output a line containing four integers, indicating the values of w_1, w_2, w_3 and w_4.\n\nExample\n\nInput\n\n3\n3 3 1 2 3 4\n2 3 1 2 3 4\n3 2 1 2 3 4\n\nOutput\n\n0 0 0 0\n1 2 3 4\n4 6 6 8","threadId":151060,"likeCnt":1,"createTime":1688286380000,"isWorkbook":false,"viewCnt":135,"openness":2,"fav":false,"id":3769,"trustable":false}