Korotkodul

Snark

Jan 7th, 2022 (edited)
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 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. using namespace std;
  12. using ll = long long;
  13. using ld = long double;
  14. void cv(vector <int> &v){
  15.     for (auto x: v) cout<<x<<' ';
  16.     cout<<"\n";
  17. }
  18.  
  19. void cvv(vector <vector <int> > &v){
  20.     for (auto x: v) cv(x);
  21.     cout<<"\n";
  22. }
  23.  
  24.  
  25. int main()
  26. {
  27.     ios::sync_with_stdio(0);
  28.     cin.tie(0);
  29.     cout.tie(0);
  30.     //cout.precision(8);
  31.     int t; cin>>t;
  32.     int n,q;
  33.     for (int act = 0; act < t; ++act){
  34.         cin>>n>>q;
  35.         vector <int> ar(n);
  36.         for (int &x: ar) cin>>x;
  37.         for (int i=0;i<q;++i){
  38.             pii x, y; cin>>x.first>>x.second>>y.first>>y.second;
  39.             if (x.first > y.first ) swap(x, y);
  40.             //cout<<"x "<<x.first<<' '<<x.second<<"\n";
  41.             //cout<<"y "<<y.first<<' '<<y.second<<"\n";
  42.             x.first--; x.second--; y.first--; y.second--;
  43.             int sz = (y.first - x.first) + 2 * (x.second - y.first + 1) + (y.second - x.second);
  44.             /*cout<<"(y.first - x.first) = "<<(y.first - x.first)<<"\n";
  45.             cout<<"2 * (x.second - y.first + 1) = "<<2 * (x.second - y.first + 1)<<"\n";
  46.             cout<<"(y.second - x.second) = "<<(y.second - x.second)<<"\n";
  47.             cout<<"sz = "<<sz<<"\n";*/
  48.         }
  49.     }
  50. }
  51.  
Add Comment
Please, Sign In to add comment