fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. class Solution{
  10. public:
  11. vector<vector<int>> queensAttacktheKing(vector<vector<int>>& Q, vector<int>& K){
  12. int dx, i;
  13. int x;
  14. int y;
  15. int mp[8][8] = {};
  16. vector<vector<int>> res;
  17. for(i=(0);i<(Q.size());i++){
  18. mp[Q[i][0]][Q[i][1]] = 1;
  19. }
  20. for(dx=(-1);dx<(2);dx++){
  21. int dy;
  22. for(dy=(-1);dy<(2);dy++){
  23. if(dx || dy){
  24. x = K[0];
  25. y = K[1];
  26. for(;;){
  27. x += dx;
  28. y += dy;
  29. if(x < 0 || x >= 8 || y < 0 || y >= 8){
  30. break;
  31. }
  32. if(mp[x][y]){
  33. res.push_back({x,y});
  34. break;
  35. }
  36. }
  37. }
  38. }
  39. }
  40. return res;
  41. }
  42. }
  43. ;
  44. // cLay varsion 20191102-1
  45.  
  46. // --- original code ---
  47. // #define main dummy_main
  48. // {}
  49. // #undef main
  50. //
  51. // class Solution {
  52. // public:
  53. // vector<vector<int>> queensAttacktheKing(vector<vector<int>>& Q, vector<int>& K) {
  54. // int x, y;
  55. // int mp[8][8] = {};
  56. // vector<vector<int>> res;
  57. // rep(i,Q.size()) mp[Q[i][0]][Q[i][1]] = 1;
  58. //
  59. // rep(dx,-1,2) rep(dy,-1,2) if(dx || dy){
  60. // x = K[0];
  61. // y = K[1];
  62. // for(;;){
  63. // x += dx;
  64. // y += dy;
  65. // if(x < 0 || x >= 8 || y < 0 || y >= 8) break;
  66. // if(mp[x][y]) res.push_back({x,y}), break;
  67. // }
  68. // }
  69. // return res;
  70. // }
  71. // };
  72.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty