#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 |
316 KB |
Output is correct |
4 |
Correct |
18 ms |
1004 KB |
Output is correct |
5 |
Correct |
34 ms |
1700 KB |
Output is correct |
6 |
Correct |
132 ms |
5540 KB |
Output is correct |
7 |
Correct |
278 ms |
10824 KB |
Output is correct |
8 |
Correct |
218 ms |
9032 KB |
Output is correct |
9 |
Correct |
202 ms |
8396 KB |
Output is correct |
10 |
Correct |
140 ms |
6092 KB |
Output is correct |
11 |
Correct |
132 ms |
6084 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 |
316 KB |
Output is correct |
4 |
Correct |
18 ms |
1004 KB |
Output is correct |
5 |
Correct |
34 ms |
1700 KB |
Output is correct |
6 |
Correct |
132 ms |
5540 KB |
Output is correct |
7 |
Correct |
278 ms |
10824 KB |
Output is correct |
8 |
Correct |
218 ms |
9032 KB |
Output is correct |
9 |
Correct |
202 ms |
8396 KB |
Output is correct |
10 |
Correct |
140 ms |
6092 KB |
Output is correct |
11 |
Correct |
132 ms |
6084 KB |
Output is correct |
12 |
Incorrect |
69 ms |
2900 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 |
212 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 |
316 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 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 |
316 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |