#include <bits/stdc++.h>
using namespace std;
long int bezw(long int j)
{
if(j<0) j*=-1;
return j;
}
int main()
{
int N;
cin >> N;
int A[N+1],B[N+1];
for(int i=0;i<N;i++)
{
cin >> A[i] >> B[i];
}
long int nadmiar=0;
long int wynik=0;
for(int i=0;i<N;i++)
{
nadmiar+=A[i]-B[i];
wynik+=bezw(nadmiar);
}
cout << wynik;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
18 ms |
920 KB |
Output is correct |
5 |
Correct |
35 ms |
1692 KB |
Output is correct |
6 |
Correct |
134 ms |
5560 KB |
Output is correct |
7 |
Correct |
270 ms |
10844 KB |
Output is correct |
8 |
Correct |
224 ms |
9072 KB |
Output is correct |
9 |
Correct |
205 ms |
8412 KB |
Output is correct |
10 |
Correct |
133 ms |
6104 KB |
Output is correct |
11 |
Correct |
132 ms |
6096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
18 ms |
920 KB |
Output is correct |
5 |
Correct |
35 ms |
1692 KB |
Output is correct |
6 |
Correct |
134 ms |
5560 KB |
Output is correct |
7 |
Correct |
270 ms |
10844 KB |
Output is correct |
8 |
Correct |
224 ms |
9072 KB |
Output is correct |
9 |
Correct |
205 ms |
8412 KB |
Output is correct |
10 |
Correct |
133 ms |
6104 KB |
Output is correct |
11 |
Correct |
132 ms |
6096 KB |
Output is correct |
12 |
Incorrect |
68 ms |
2920 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
300 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
0 ms |
300 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
0 ms |
300 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |