// #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define sz(x) (int)x.size()
#define bit(a, i) ((a>>i)&1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int P = 18;
const int K = 800;
const ll INF = 2e18;
const int inf = 1e9;
const int mod = 1e9+7;
const int maxm = 5e2+10;
const int maxn = 5e5+10;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};
int n, x;
int a[maxn];
int b[maxn];
ll d[4*maxn];
int t[4*maxn];
int u[4*maxn];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
ll sum = 0, ans = 0;
for(int i=1; i<=n; i++){
cin >> a[i] >> b[i];
sum += a[i];
sum -= b[i];
ans += abs(sum);
} cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
2 ms |
4444 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Correct |
6 ms |
4696 KB |
Output is correct |
5 |
Correct |
10 ms |
4952 KB |
Output is correct |
6 |
Correct |
31 ms |
7764 KB |
Output is correct |
7 |
Correct |
66 ms |
11620 KB |
Output is correct |
8 |
Correct |
50 ms |
9404 KB |
Output is correct |
9 |
Correct |
60 ms |
8752 KB |
Output is correct |
10 |
Correct |
38 ms |
6480 KB |
Output is correct |
11 |
Correct |
39 ms |
6588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
2 ms |
4444 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Correct |
6 ms |
4696 KB |
Output is correct |
5 |
Correct |
10 ms |
4952 KB |
Output is correct |
6 |
Correct |
31 ms |
7764 KB |
Output is correct |
7 |
Correct |
66 ms |
11620 KB |
Output is correct |
8 |
Correct |
50 ms |
9404 KB |
Output is correct |
9 |
Correct |
60 ms |
8752 KB |
Output is correct |
10 |
Correct |
38 ms |
6480 KB |
Output is correct |
11 |
Correct |
39 ms |
6588 KB |
Output is correct |
12 |
Incorrect |
16 ms |
6236 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
2 ms |
4444 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
2 ms |
4444 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
2 ms |
4444 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4700 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |