emotionles's blog

By emotionles, 10 years ago, In English

I am trying to solve this problem for this input. My code is here. My codeblocks compiler gives output 3. And also a online compiler "ideone" (code) gives output 3. But in my submission it gives output 2. I don't know why this kind different output in different compilers. Please anyone help me. Thanks in advanced.

  • Vote: I like it
  • +12
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

if(adjn == pre) continue;
pre is not initilized and equals to 4 when cn = 3, adjn = 4

Z tmp;
tmp.v = s;
tmp.w = 0;
priority_queue<Z>PQ;
//tmp.pre = -1;
PQ.push(tmp);