Can someone help me, I am facing this(Title) runtime error while submitting my solution to the problem 1822F - Gardening Friends Link to my submission-[submission:206155993]. The solution is working on my VS Code and various online IDEs. Thanks.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Can someone help me, I am facing this(Title) runtime error while submitting my solution to the problem 1822F - Gardening Friends Link to my submission-[submission:206155993]. The solution is working on my VS Code and various online IDEs. Thanks.
Название |
---|
Clion says that in line: int x1 = G[s][ind]; you have s = 0, ind = -1.
I have run your code on custom invocation and I wanted to tell you where the error is. The error is in variable x2 (at line 179), it's value is like 2882432546906025180 if you run it on test case 2 and output x2 before saying dp[x2] (which will of course go out of bounds). When your own IDE is giving correct and CF is not then run on Custom Invocation to check where is the fault.
Just a suggestion that, kindly write your codes such that they are more readable and understandable, look at other people codes (after getting accepted or lot of hard work) to learn how to improve implementation. I have got it accepted just now, you can see my code, and you can ask me if you don't understand something.
My Code : 206168140.
Thanks
how did u find the specific error? how do we correctly use custom invocation? All i do is cout my variables and check for out of bounds conditions. Is there any better way to debug using custom invocation?
I actually did not know what was going in his code, So I just used kind of binary search and wrote
at different lines, which told me that the part till here does not have an error. And found the line which had the error.
I was just curious as to why it happens that on some IDE it works and on some it doesn't.
On the IDE it works, I think that IDE might be using some optimizations/smartness, like Sometimes I don't (when using
#include <iostream>
) include vector but the IDE is smart and does not give me error that you didn't include vector... but this is not standard C++. You have to include vector otherwise you will get compilation error on Codeforces. I think both of the cases are same, but not sure.There is some undefined behavior in your code
Please check if globid1 and globid2 can be -1 when you execute G[globsrc][globid1] and G[globsrc][globid2];