Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя emotionles

Автор emotionles, 10 лет назад, По-английски

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.

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 2   Проголосовать: нравится +6 Проголосовать: не нравится

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);