Question about output

Question about output

shakal187's picture

Is it really necessary that output of our program is exact match to given output.txt file? In our case because second test case is shorter that task is executed faster than the first one so we get that second test case is written first on the console window.

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
mmilena's picture

Hi! It is necessary! They said: "Result has to be exactly the same as this reference code for any set of input-output-parameters.". You should sort output before printing it.

shakal187's picture

The result is the same, but order is not. It's like this: test_sequence_2 1342 1392 1700 1750 test_sequence_1 1 910 771 1680 911 1680 1 770 1681 2088 1681 2088 it's because one core is computing one sequence and the second core the second

Stevan Medić's picture

I get the same result when i put-tbb::task_scheduler_init init(1); , but when i put 2,3,4 instead of 1, i get totally messed up result lines. Does anybody know how to solve this ? Problem is caused by parallel_do and i dont know how to explicitly organize my threads :/

rueller's picture

Hello I don't know il you always have the problem, but you can for example store your results in a map and sort it after the computs (after all the threads stops)

chatpirate's picture

hello! yes,thereare quite away tomanagethis problem,like usingthe# pragmaompbarrierandthen viewthe result,threadbythread,or,to put away allthesequensein a structureand thentodisplay theresult with one thread

chatpirate's picture

for your information,you needto displaythe sequencename,even if itis empty

Login to leave a comment.