Skip to content

Instantly share code, notes, and snippets.

@ArthurLoboLobo
Created June 1, 2023 02:37
Show Gist options
  • Save ArthurLoboLobo/0788012b7de81c14b5ad868cfaa1a4a4 to your computer and use it in GitHub Desktop.
Save ArthurLoboLobo/0788012b7de81c14b5ad868cfaa1a4a4 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int n, a[maxn], b[maxn];
int main() {
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
for(int i = 1; i <= n; i++) {
cin >> b[i];
}
int pagar = 0;
int receber = 0;
for(int i = 1; i <= n; i++) {
if(a[i] >= b[i]) {
receber+= a[i]-b[i];
}
else {
pagar+= b[i]-a[i];
}
}
cout << receber << " " << pagar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment