我也是这样,但是我查看别的通过的java代码时,发现了一段神仙代码!!! public int solve (int n, int x, Point[] Edge) { try{ Thread t = new Thread(null,()->{ solve0(n, x, Edge); },"", 1 << 30); t.start(); t.join(); }catch(Exception e){ } // write code here return ans+1; } 我照着他的做法,把dfs的程序另开一个线程,居然真的过了!!,真的过了。 可是搞不懂是什么原理啊。
点赞
牛客网
牛客网在线编程
牛客网题解
牛客企业服务