#29735: 太扯了貼官方解答居然會RE


GGdadader (GG)

學校 : 臺北市私立延平高級中學
編號 : 151870
來源 : [1.200.249.195]
最後登入時間 :
2022-03-27 18:35:06
h559. pC. 共享自行車 (bike) -- TOI入營考2022 | From: [114.25.56.74] | 發表日期 : 2022-03-27 18:23

https://github.com/twpca/toi-primary-2022/blob/main/solution/tester3/bike.cc

 
#29740: Re:太扯了貼官方解答居然會RE


r1cky (hehe)

學校 : 國立臺灣師範大學
編號 : 158637
來源 : [140.122.136.180]
最後登入時間 :
2024-05-14 10:21:00
h559. pC. 共享自行車 (bike) -- TOI入營考2022 | From: [210.71.78.245] | 發表日期 : 2022-03-28 15:25

https://github.com/twpca/toi-primary-2022/blob/main/solution/tester3/bike.cc

這題測試資料使用的是官方的側資的"一部分",應該不至於是測資有誤(頂多是卡不了假解),至於RE的話我也不太懂原因,但是我使用另一個tester的程式卻可AC,也許是他程式有漏洞?

 
#29741: Re:太扯了貼官方解答居然會RE


r1cky (hehe)

學校 : 國立臺灣師範大學
編號 : 158637
來源 : [140.122.136.180]
最後登入時間 :
2024-05-14 10:21:00
h559. pC. 共享自行車 (bike) -- TOI入營考2022 | From: [210.71.78.245] | 發表日期 : 2022-03-28 15:32

https://github.com/twpca/toi-primary-2022/blob/main/solution/tester3/bike.cc

這題測試資料使用的是官方的側資的"一部分",應該不至於是測資有誤(頂多是卡不了假解),至於RE的話我也不太懂原因,但是我使用另一個tester的程式卻可AC,也許是他程式有漏洞?

好像是這兩行的問題,因為我把dfs關掉也是RE,把這兩行刪掉就剩WA。

 g[u].emplace_back(v, c);

 g[v].emplace_back(u, c);

 
#29744: Re:太扯了貼官方解答居然會RE


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
h559. pC. 共享自行車 (bike) -- TOI入營考2022 | From: [27.53.33.71] | 發表日期 : 2022-03-29 09:19

https://github.com/twpca/toi-primary-2022/blob/main/solution/tester3/bike.cc


大概是遞迴太多次造成stack overflow?

Program received signal SIGSEGV, Segmentation fault.
0x00005555555551db in dfs (k=10, w=<error reading variable: Cannot access memory at address 0x7fffff7feff8>, g=<error reading variable: Cannot access memory at address 0x7fffff7feff0>, u=0, p=<error reading variable: Cannot access memory at address 0x7fffff7fefec>) at main.cpp:14
14    tuple<int, int, i64> dfs(int k, int const *w, vector<Edge> const *g, int u, int p){

 
ZeroJudge Forum