Hello ..
this is what I'm telling my code to output :3 :
AND this is the output !!!
like you see , there is equality between temp and check but the output is different !!
full code : http://pastebin.com/8v0GgHXd
Thank you in advance :D
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
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 |
Hello ..
this is what I'm telling my code to output :3 :
AND this is the output !!!
like you see , there is equality between temp and check but the output is different !!
full code : http://pastebin.com/8v0GgHXd
Thank you in advance :D
Name |
---|
Auto comment: topic has been updated by notAboAlmanalAnyMore (previous revision, new revision, compare).
You're using the same vis array between the two different calls. If you want to reproduce the same results, you should at least clear the array vis between the two calls.
I'm clearing the array vis between the two calls by " memset(vis, 0, sizeof(vis)); "
didn't you see it ?! :p
No, you aren't. You call memset() before you call check(i) twice in a row.
Oh got it , thank you very much =D
you must put another memset between - temp = check(i); - and cout << temp << " " << check(i) << endl ;
because you are calling check( i ) two times and v is changing
Your
check
function is not pure: it modifies global state (specifically, thevis
array). Naturally, an impure function is not guaranteed to return the same value each time it is called with the same arguments (that is, it is not a function in mathematical sense).If you call
check
on a vertex with no outgoing edges, the result is unspecified (no return statement).And, contrary to what you state in another comment thread, there is no
memset
between two calls tocheck
, which are at lines 54 and 55.thank you very much and sorry for my intransigence :p =D