Untitled
unknown
c_cpp
a year ago
3.3 kB
6
Indexable
#include <bits/stdc++.h> //───▐▀▄──────▄▀▌───▄▄▄▄▄▄▄ #define ll long long //───▌▒▒▀▄▄▄▄▀▒▒▐▄▀▀▒██▒██▒▀▀▄•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define f first //──▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define s second //──▌▒▒▒▒▒▒▒▒▒▒▒▒▒▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define pb push_back //▀█▒▒█▌▒▒█▒▒▐█▒▒▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▌•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define ub upper_bound //▀▌▒▒▒▒▒▀▒▀▒▒▒▒▒▀▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐ ▄▄•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define lb lower_bound //▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄█▒█•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define np next_permutation//▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▀•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define us unordered_set //──▐▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄▌•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ #define cont continue //────▀▄▄▀▀▀▀▄▄▀▀▀▀▀▀▄▄▀▀▀▀▀▀▄▄▀•.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ •.,¸,.•*`•.,¸¸,.•*¯ using namespace std; //*What if she's fine? *// //*It's my mind that's wrong*// //*And I just let bad thoughts*// //*Linger for far too long*// //* Steve Lacy *// const ll MAXN = 1e7; /*ll a,b,c,d; vector<int> divis[MAXN+10];*/ int main() { ll n, m; cin >> n >> m; ll a[n], b[m]; ll res[n+m]; for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int j = 0; j < m; ++j) { cin >> b[j]; } int i = 0, j = 0, k = 0; while(i < n && j < m){ if (a[i] < b[j]) { res[k] = a[i]; i++; k++; } else { res[k] = b[j]; j++; k++; } } while(i < n){ res[k] = a[i]; k++; i++; } while(j < m){ res[k] = b[j]; k++; j++; } for(int i = 0; i < n+m; i++){ cout << res[i] << " "; } } /* Eratosphen's sieve formule bool was[MAXN+10]; for(int i = 2; i*i <= MAXN; i++){ if(!was[i]){ for(int j = i*i; j <= MAXN; j+=i+i) was[j]=true; } } */
Editor is loading...
Leave a Comment