fork download
  1. int n;
  2. set<pair<int, int>> st;
  3. void solve(int i, int x, int y, int turn){
  4. if(i == n)
  5. {
  6. st.insert({x, y});
  7. return;
  8. }
  9.  
  10.  
  11. if(turn == 1 || turn == 0)
  12. {
  13. solve(i + 1, x, y + 1, 2);
  14. solve(i + 1, x, y - 1, 2);
  15. }
  16. if(turn == 2 || turn == 0)
  17. {
  18. solve(i + 1, x + 1, y, 1);
  19. solve(i + 1, x - 1, y, 1);
  20. }
  21. }
  22.  
  23. //let n be the number of moves
  24. //call solve(0, 0, 0, 0);
  25. //Answer is st.size();
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:1: error: ‘set’ does not name a type
 set<pair<int, int>> st;
 ^~~
prog.cpp: In function ‘void solve(int, int, int, int)’:
prog.cpp:6:9: error: ‘st’ was not declared in this scope
         st.insert({x, y});
         ^~
prog.cpp:6:9: note: suggested alternative: ‘std’
         st.insert({x, y});
         ^~
         std
stdout
Standard output is empty