Same code gives different answers on different platforms.

Revision en7, by masterchief164, 2021-03-20 12:41:45

1399C - Boats Competition
I've tried to solve the problem using both maps and unordered_maps The failed code and the accepted code.
The accepted code used maps and the failed code uses unordered_maps. But the funny thing is that when I run the code on my machine it gives the correct output while when I submit the code it fails. I know that maps sorts it's elements while unordered_maps don't. Moreover there is no need of sorting the elements as per the question as it requires simple brute force.
I've tried to run it on gcc 17 on my machine (hope it helps). Here is the output on my machine.

Tags #std::map, unordered_map

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English masterchief164 2021-03-20 12:41:45 0 Tiny change: 're is the output[output](/' -> 're is the [output](/' (published)
en6 English masterchief164 2021-03-20 12:41:04 6 Tiny change: 're is the output[output](/' -> 're is the [output](/'
en5 English masterchief164 2021-03-20 12:40:46 246
en4 English masterchief164 2021-03-20 12:39:21 26
en3 English masterchief164 2021-03-20 12:38:33 8 Tiny change: '.\nP.S. : — This is m' -> '.\nP.S. : This is m'
en2 English masterchief164 2021-03-20 12:38:07 7 Tiny change: 'maps don't and moreover th' -> 'maps don't. Moreover th'
en1 English masterchief164 2021-03-20 12:37:10 1016 Initial revision (saved to drafts)