fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int ans=0;
  6. int b1x,b1y,b2x,b2y,tx,ty,b1x2,b1y2,b2x2,b2y2,tx2,ty2;
  7. cin>>b1x>>b1y>>b1x2>>b1y2>>b2x>>b2y>>b2x2>>b2y2>>tx>>ty>>tx2>>ty2;
  8. for(int i = -1000; i<=1000; i++){
  9. for(int j=-1000;j<=1000; j++){
  10. if((j>=b1x&&j<=b1x2-1&&i>=b1y&&i<=b1y2-1) || (j>=b2x&&j<=b2x2-1&&i>=b2y&&i<=b2y2-1)){
  11. if(!(j>=tx&&j<=tx2-1&&i>=ty&&i<=ty2-1)){
  12. ans++;
  13. }
  14. }
  15. }
  16. }
  17. cout<<ans;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5284KB
stdin
1 2 3 5
6 0 10 4
2 1 8 3
stdout
17