Korotkodul

урал B

Mar 1st, 2022 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int,int>
  11. #define pll pair <long long, long long>
  12. #define vec vector
  13. #include <numeric>
  14. using namespace std;
  15. using ll = long long;
  16. using ld = long double;
  17. using db = double;
  18. void cv(vector <int> &v){
  19. for (auto x: v) cout<<x<<' ';
  20. cout<<"\n";
  21. }
  22.  
  23. void cvl(vector <ll> &v){
  24. for (auto x: v) cout<<x<<' ';
  25. cout<<"\n";
  26. }
  27.  
  28.  
  29. void cvv(vector <vector <int> > &v){
  30. for (auto x: v) cv(x);
  31. cout<<"\n";
  32. }
  33.  
  34. void cvb(vector <bool> v){
  35. for (bool x: v) cout<<x<<' ';
  36. cout<<"\n";
  37. }
  38.  
  39. void cvs(vector <string> v){
  40. for (auto a: v){
  41. cout<<a<<"\n";
  42. }
  43. }
  44.  
  45. bool cmpmn(pii a, pii b){
  46. return a.first * b.second - b.first * a.second < 0;
  47. }
  48.  
  49. bool cmpmx(pii a, pii b){
  50. return a.first * b.second - b.first * a.second > 0;
  51. }
  52.  
  53. pll mini , maxi;
  54.  
  55.  
  56.  
  57. void mrgmn(pii x){
  58. ll cmn = lcm(mini.second, x.second);
  59. pll after;
  60. after.first = mini.first * (cmn / mini.second) + x.first * (cmn / x.second);
  61. after.second = cmn;
  62.  
  63. ll cmn2 = lcm(mini.second, cmn);
  64. ll dlt =
  65. }
  66.  
  67.  
  68. int main()
  69. {
  70. ios::sync_with_stdio(0);
  71. cin.tie(0);
  72. cout.tie(0);
  73. int n;
  74. //cin>>n
  75. vector <pii> slt(n);
  76. for (int i = 0; i<n;++i){
  77. // cin>>slt[i].second>>slt[i].first;
  78. }
  79. vector <pii> mn = slt, mx = slt;
  80. sort(mn.begin(), mn.end(), cmpmn);
  81. sort(mx.begin(), mx.end(), cmpmx);
  82.  
  83. mini.first = mn[0].first;
  84. mini.second = mn[0].second;
  85. maxi.first = mx[0].first;
  86. maxi.second = mx[0].second;
  87. for (int i = 1; i < n;++i){
  88. 0 - концентрация уменьш, 1 - увелич
  89. mrgmn(mini, mn[i]);
  90. mrgmx(maxi, mx[i]);
  91. }
  92. }
  93.  
Add Comment
Please, Sign In to add comment