Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef int l;
- typedef long long int ll;
- #define loop(a, b) for(int i = a; i < b; i++)
- #define PI acos(-1.0)
- const ll INF = LLONG_MAX;
- const ll mod = 1000000007;
- ll gcd(ll a,ll b){ if(b == 0) return a; return gcd(b, a % b); }
- ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
- ll power(ll a, ll b){ll res = 1;while(b){if(b&1) res = (res*a)%mod;b>>=1;a = (a*a)%mod;}return res%mod;}
- //leftmost set bit
- l clz(int N) {return N ? 32 - __builtin_clz(N) : -(1e9+1);}
- //ll clz(unsigned long long N){return N ? 64 - __builtin_clzll(N) : -(1e18+1);}
- l setbit(l x){return __builtin_popcountll(x);}
- //ll power(ll a, ll b){ll res = 1;while(b){if(b&1) res = (res*a);b>>=1;a = (a*a);}return res;}
- bool arraySortedOrNot(int arr[], int n){if (n == 0 || n == 1) return true;for (int i = 1; i < n; i++)if (arr[i - 1] > arr[i]) return false;return true;}
- // long long v[400002];
- // void Quicksort(int begin,int end){
- // int e,b,aux,p;b=begin;e=end;p=v[(e+b)/2];
- // while(v[b]<p){b++;}while(v[e]>p){e--;}while(b<e){aux=v[b];v[b]=v[e];v[e]=aux;do{b++;}while(v[b]<p);
- // do{e--;}while(v[e]>p);}if(begin<e){ Quicksort(begin,e);}
- // if(e+1<end){ Quicksort(e+1,end);}
- // }
- // string decimalToBinary(l n)
- // {
- // string s = bitset<64> (n).to_string();
- // const auto loc1 = s.find('1');
- // if(loc1 != string::npos) return s.substr(loc1);
- // }
- void run(){
- ios::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output7.txt", "w", stdout);
- #else
- #endif
- }
- l o = 1;
- void solve(){
- l x;cin>>x;
- l a,b,c,d,e,f;
- cin>>a>>b>>c>>d>>e>>f;
- l a1 = a,b1 = b,c1 = c,d1 = d,e1 = e,f1 = f;
- x--;
- l res = 0;
- while(x--){
- cin>>a>>b>>c>>d>>e>>f;
- a1 = max(a1,a);d1 = min(d1,d);
- b1 = max(b1,b);e1 = min(e1,e);
- c1 = max(c1,c);f1 = min(f1,f);
- }
- if(d1-a1 > 0 && e1-b1 > 0 && f1-c1 > 0){
- res = (d1-a1)*(e1-b1)*(f1-c1);
- cout << "Case "<< o++ << ": " << res << endl;
- return;
- }
- cout << "Case "<< o++ << ": " << res << endl;
- }
- int main()
- {
- //clock_t tStart = clock();
- run();
- //precal();
- l n;cin>>n;
- while(n--) {solve();}
- //printf("Time taken: %.10fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement