This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |