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>
- using namespace std;
- using ll = long long;
- using ld = long double;
- void cv(vector <int> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvv(vector <vector <int> > &v){
- for (auto x: v) cv(x);
- cout<<"\n";
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- //cout.precision(8);
- int t; cin>>t;
- int n,q;
- for (int act = 0; act < t; ++act){
- cin>>n>>q;
- vector <int> ar(n);
- for (int &x: ar) cin>>x;
- for (int i=0;i<q;++i){
- pii x, y; cin>>x.first>>x.second>>y.first>>y.second;
- if (x.first > y.first ) swap(x, y);
- //cout<<"x "<<x.first<<' '<<x.second<<"\n";
- //cout<<"y "<<y.first<<' '<<y.second<<"\n";
- x.first--; x.second--; y.first--; y.second--;
- int sz = (y.first - x.first) + 2 * (x.second - y.first + 1) + (y.second - x.second);
- /*cout<<"(y.first - x.first) = "<<(y.first - x.first)<<"\n";
- cout<<"2 * (x.second - y.first + 1) = "<<2 * (x.second - y.first + 1)<<"\n";
- cout<<"(y.second - x.second) = "<<(y.second - x.second)<<"\n";
- cout<<"sz = "<<sz<<"\n";*/
- }
- }
- }
Add Comment
Please, Sign In to add comment