-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincadd.cpp
More file actions
38 lines (37 loc) · 830 Bytes
/
incadd.cpp
File metadata and controls
38 lines (37 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
#define ln long long
using namespace std;
int main()
{
// your code goes here
// ia_anuj_10
ln num, num1, q, a;
cin >> num;
while (num--)
{
// int num1, q;
cin >> num1 >> q;
vector<int> arr1(num1);
for (int c = 0; c < num1; c++)
cin >> arr1[c];
while (q--)
{
//ia_anuj_10
// int c, a;
int c;
cin >> c >> a;
arr1[c - 1] = a;
int result = 0;
for (int d = 0; d < num1-1; d++)
{
if (arr1[d] > arr1[d + 1])
{
result = max(result, abs(arr1[d] - arr1[d + 1]));
}
}
cout << result
<< "\n";
}
}
return 0;
}