fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. constexpr int GetRouteCount(int map, int x, int y) {
  5. return ((x == -1) || (y == -1) || (x == 4) || (y == 4)) ? 0 :
  6. ((x == 3) && ( y == 3)) ? 1 :
  7. ( ( map & (1 << ( ( x << 2) +y) )) != 0 ) ? 0 :
  8. (map |= (1 << ( (x << 2) +y)) , GetRouteCount(map, x-1, y) +
  9. GetRouteCount(map, x+1, y) +
  10. GetRouteCount(map, x, y-1) +
  11. GetRouteCount(map, x, y+1));
  12. }
  13.  
  14. int main() {
  15. cout << GetRouteCount(0, 0, 0) << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3300KB
stdin
Standard input is empty
stdout
184