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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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