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 | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 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