fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class S, class T> inline S divup_L(S a, T b){
  5. return (a+b-1)/b;
  6. }
  7. template<class S, class T> inline S chmax(S &a, T b){
  8. if(a<b){
  9. a=b;
  10. }
  11. return a;
  12. }
  13. #define main dummy_main
  14. int main(){
  15. return 0;
  16. }
  17. #undef main
  18. class Solution{
  19. public:
  20. int minKnightMoves(int x, int y){
  21. int res = 0;
  22. x = abs(x);
  23. y = abs(y);
  24. if(x+y==1){
  25. return 3;
  26. }
  27. if(x==y && y==2){
  28. return 4;
  29. }
  30. chmax(res,divup_L(x,2));
  31. chmax(res,divup_L(y,2));
  32. chmax(res,divup_L((x+y),3));
  33. if(res % 2 != (x+y) % 2){
  34. res++;
  35. }
  36. return res;
  37. }
  38. }
  39. ;
  40. // cLay varsion 20190921-1
  41.  
  42. // --- original code ---
  43. // #define main dummy_main
  44. // {}
  45. // #undef main
  46. //
  47. // class Solution {
  48. // public:
  49. // int minKnightMoves(int x, int y) {
  50. // int res = 0;
  51. // x = abs(x);
  52. // y = abs(y);
  53. // if(x+y==1) return 3;
  54. // if(x==y==2) return 4;
  55. // res >?= x /+ 2;
  56. // res >?= y /+ 2;
  57. // res >?= (x+y) /+ 3;
  58. // if(res % 2 != (x+y) % 2) res++;
  59. // return res;
  60. // }
  61. // };
  62.  
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