Submission #912442

# Submission time Handle Problem Language Result Execution time Memory
912442 2024-01-19T13:11:32 Z vjudge1 Potatoes and fertilizers (LMIO19_bulves) C++17
24 / 100
113 ms 19864 KB
#include <bits/stdc++.h>
#define f first
#define s second	
#define ent '\n'
#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

using namespace std;
typedef long long ll;
const int mx=1e6+12;
const int mod=1e9+7;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int a[mx];
int n,m,k;

void Press_Fn_with_F11(){
	cin>>n;
	set<int> s;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		a[i]=x-y;
		if(a[i]>0)s.insert(i);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans+=abs(a[i]);
		a[i+1]+=a[i];
	}
	cout<<ans<<ent;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int Alikhan_abi_crush=1;
	// cin>>Alikhan_abi_crush;
	while(Alikhan_abi_crush--){
		Press_Fn_with_F11();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 9 ms 4188 KB Output is correct
5 Correct 18 ms 5336 KB Output is correct
6 Correct 40 ms 6992 KB Output is correct
7 Correct 113 ms 19864 KB Output is correct
8 Correct 95 ms 19032 KB Output is correct
9 Correct 100 ms 18736 KB Output is correct
10 Correct 83 ms 17488 KB Output is correct
11 Correct 83 ms 17596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 9 ms 4188 KB Output is correct
5 Correct 18 ms 5336 KB Output is correct
6 Correct 40 ms 6992 KB Output is correct
7 Correct 113 ms 19864 KB Output is correct
8 Correct 95 ms 19032 KB Output is correct
9 Correct 100 ms 18736 KB Output is correct
10 Correct 83 ms 17488 KB Output is correct
11 Correct 83 ms 17596 KB Output is correct
12 Incorrect 23 ms 5972 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -