I think judge is wrong
It seems judge mark it as wrong if philosopher picks up one fork but wait for other to be available.\n\nCode judged as wrong:\ncpp\nclass DiningPhilosophers {\n
It seems judge mark it as wrong if philosopher picks up one fork but wait for other to be available.\n\nCode judged as wrong:\n```cpp\nclass DiningPhilosophers {\n    mutex fork[5];\npublic:\n    DiningPhilosophers() {\n        \n    }\n\n    void wantsToEat(int p,\n                    function<void()> pickLeftFork,\n                    function<void()> pickRightFork,\n                    function<void()> eat,\n                    function<void()> putLeftFork,\n                    function<void()> putRightFork) {     \n        \n        if (p & 1) {\n            fork[p].lock();\n            fork[(p+1)%5].lock();\n            pickLeftFork();\n            pickRightFork();\n            eat();\n            putLeftFork();\n            putRightFork();\n            fork[p].unlock();\n            fork[(p+1)%5].unlock();\n        } else {\n            fork[(p+1)%5].lock();\n            fork[p].lock();\n            pickRightFork();\n            pickLeftFork();\n            eat();\n            putLeftFork();\n            putRightFork();\n            fork[p].unlock();\n            fork[(p+1)%5].unlock();\n        }\n    }\n};\n```\n\nCode judged as accepted:\n```cpp\nclass DiningPhilosophers {\n    mutex fork[5];\npublic:\n    DiningPhilosophers() {\n        \n    }\n\n    void wantsToEat(int p,\n                    function<void()> pickLeftFork,\n                    function<void()> pickRightFork,\n                    function<void()> eat,\n                    function<void()> putLeftFork,\n                    function<void()> putRightFork) {     \n        \n        if (p & 1) {\n            fork[p].lock();\n            fork[(p+1)%5].lock();\n            pickLeftFork();\n            pickRightFork();\n            eat();\n            putLeftFork();\n            putRightFork();\n            fork[p].unlock();\n            fork[(p+1)%5].unlock();\n        } else {\n            fork[(p+1)%5].lock();\n            fork[p].lock();\n            pickRightFork();\n            pickLeftFork();\n            eat();\n            putLeftFork();\n            putRightFork();\n            fork[p].unlock();\n            fork[(p+1)%5].unlock();\n        }\n    }\n};\n```
[]