fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. const ll INF = 1e18;
  5.  
  6. //
  7. #define TIME (1.0* clock()/CLOCKS_PER_SEC)
  8. #define file(name) if(fopen(name".inp","r")){freopen(name".inp","r",stdin); freopen(name".out","w",stdout);}
  9. #define hackspeed ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
  10. //
  11.  
  12.  
  13. int main(){
  14. hackspeed;
  15. //file("");
  16. ll m,n,p,q; cin >> m >> n >> p >> q;
  17. ll s=-1;
  18. if((p==1 || p==m)&&(q==1||n==q)) cout << 3;
  19. else if((p==1 || p==m)||(q==1||n==q)) cout <<5;
  20. else cout << 8;
  21.  
  22.  
  23.  
  24.  
  25. //time
  26. cerr << "Time elapsed: " << TIME << "s.\n";
  27. return 0;
  28. }
  29.  
Success #stdin #stdout #stderr 0s 5316KB
stdin
Standard input is empty
stdout
8
stderr
Time elapsed: 0.004649s.