Advertisement
senb1

krsu 3366

Mar 8th, 2023
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. /*
  2. * by: senb1
  3. */
  4. #include <algorithm>
  5. #include <iomanip>
  6. #include <iostream>
  7. #include <locale>
  8. #include <numeric>
  9. #include <cstring>
  10. #include <cmath>
  11.  
  12. #include <deque>
  13. #include <list>
  14. #include <map>
  15. #include <stack>
  16. #include <string>
  17. #include <vector>
  18. #include <array>
  19. #include <queue>
  20. #include <set>
  21.  
  22. using namespace std;
  23.  
  24. #define all(x) x.begin(), x.end()
  25. #define rall(x) x.rbegin(), x.rend()
  26. #define yes cout << "YES\n"
  27. #define no cout << "NO\n"
  28. #define fr first
  29. #define sc second
  30. #define endl "\n"
  31. #define ll long long
  32. #define ull unsigned long long
  33. #define ld long double
  34. #define nl cout << "\n";
  35.  
  36. const ll maxn = 1e6 + 10; // 1000000 + 10
  37. const ll mod = 1000000000;
  38. const int inf = 1000000000;
  39. // 4294967296
  40.  
  41. ll binpow(ll a, ll b) {
  42.     ll res = 1;
  43.     while (b > 0) {
  44.         if (b & 1)
  45.             res = res * a % mod;
  46.         a = a * a % mod;
  47.         b >>= 1 % mod;
  48.     }
  49.     return res % mod;
  50. }
  51.  
  52. ll divup(ll x, ll y) {
  53.     return (x - 1) / y + 1;
  54. }
  55.  
  56. ll gcd(ll a, ll b) {
  57.     if (a % b == 0)
  58.         return b;
  59.     if (b % a == 0)
  60.         return a;
  61.     if (a > b)
  62.         return gcd(a % b, b);
  63.     return gcd(a, b % a);
  64. }
  65.  
  66. ll lcm(ll a, ll b) {
  67.     return (a * b) / gcd(a, b);
  68. }
  69.  
  70. bool isPrime(int x) {
  71.     if (x <= 1) return false;
  72.     for (int i = 2; i <= sqrt(x) + 1; i++) {
  73.         if (x % i == 0)
  74.             return false;
  75.     }
  76.     return true;
  77. }
  78.  
  79. int main() {
  80.     ios::sync_with_stdio(0); cin.tie(0);
  81.     //cout << fixed << setprecision(12);
  82.     //setlocale(LC_ALL, "RUS");
  83.  
  84.     ll n, s = 0;
  85.     cin >> n;
  86.     vector<ll> a(n), b(n), c(n);
  87.     for (int i = 0; i < n; i++) {
  88.         cin >> a[i];
  89.         s += a[i];
  90.     }
  91.     for (int i = 0; i < n; i++) {
  92.         cin >> b[i];
  93.         c[i] = b[i] - a[i];
  94.     }
  95.  
  96.     sort(all(c));
  97.  
  98.     int q = 0;
  99.     for (int k = 1; k <= n; k++) {
  100.         s += c[q];
  101.         q++;
  102.         cout << s << ' ';
  103.  
  104.     }
  105.  
  106. }
  107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement