Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int,int>
- #define pll pair <long long, long long>
- #define vec vector
- #include <numeric>
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvl(vector <ll> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvv(vector <vector <int> > &v){
- for (auto x: v) cv(x);
- cout<<"\n";
- }
- void cvb(vector <bool> v){
- for (bool x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvs(vector <string> v){
- for (auto a: v){
- cout<<a<<"\n";
- }
- }
- bool cmpmn(pii a, pii b){
- return a.first * b.second - b.first * a.second < 0;
- }
- bool cmpmx(pii a, pii b){
- return a.first * b.second - b.first * a.second > 0;
- }
- pll mini , maxi;
- void mrgmn(pii x){
- ll cmn = lcm(mini.second, x.second);
- pll after;
- after.first = mini.first * (cmn / mini.second) + x.first * (cmn / x.second);
- after.second = cmn;
- ll cmn2 = lcm(mini.second, cmn);
- ll dlt =
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int n;
- //cin>>n
- vector <pii> slt(n);
- for (int i = 0; i<n;++i){
- // cin>>slt[i].second>>slt[i].first;
- }
- vector <pii> mn = slt, mx = slt;
- sort(mn.begin(), mn.end(), cmpmn);
- sort(mx.begin(), mx.end(), cmpmx);
- mini.first = mn[0].first;
- mini.second = mn[0].second;
- maxi.first = mx[0].first;
- maxi.second = mx[0].second;
- for (int i = 1; i < n;++i){
- 0 - концентрация уменьш, 1 - увелич
- mrgmn(mini, mn[i]);
- mrgmx(maxi, mx[i]);
- }
- }
Add Comment
Please, Sign In to add comment