[The Accountant] Multiple Submissions, different results, same deterministic code ... any reason?

The title says it all … I submitted multiple times the same deterministic code (absolutely no random in it). With absolutely no difference aside the time of submission and got many different results on validators as well as points… mainly, I suppose, due to the server occupancy (if this is the right term) …

How do I ensure my code will behave always the same way and get the same score, in a time-limited fashion, if there is not always the number of processes running on the processor ?

or do I have to wait a “server-free” period to get the best results ?


Even if you have your own private bare metal hardware, you will not get deterministic performance. This is just life in modern computing. Try to make the code less dependent on getting a few more instructions out of it, or submit many times.

1 Like

if there is not always the number of processes running on the processor ?

The code is run on identical hardware and only one physical core is allocated to your program. However, the program runs on a Linux machine with an unmodified scheduler, this can cause a small fluctuation.

Most of the time, when I encounter non-deterministic behavior without using any random functions, this is caused by data structures that are not deterministic such as an iteration over th keys of an hashmap for instance. In a lot of programming languages there are undetermined behaviors.


I read as well that we have a processor dedicated to our code … but I’m not sure if it is true in that case … so much variations to blame only HashMap no ?

And as far as I can tell, if the hashcodes are the same, the HashMap would behave the same way on two different iteration … or i missed something about HashMap ?

I would have more tendency to blame the time allowed to my procezss between to submission … but I maybe wrong.

Anyway… it seems that I will have to stop using advanced structures such as map and such and starting coding in C/C++ without STL to keep up with the solutions out there :slight_smile:

A core of a multi-core processor. You can suffer of some delays due to cache thrashing on the L3 cache.

Kam : What do you call perfectly deterministic ?

For example. If somebody uses a random number generator, BUT the seed is fixed : is this a deterministic code ?

Perfectly deterministic as : I did not willingly and consciously put a Random generator in my code :slight_smile:

To my knowledge of Java (which I use), no non-determinism is used in data structure, such as sets and maps and I did not see any source of other variation than the time allowed to my process to compute a better (or worse) solution :wink:

If your algorithm has a cutoff based on time, it is not deterministic. You would only be deterministic if the inner loops are run for a fixed number of iterations.

For example, the following pseudo code will produce a somewhat random number :
int i = 0; while(elaspedTime < 100ms) { ++i; } std::cout << i;

Well, the algorithm I used is deterministic … but due to a cutoff based on time its outcome become based on allowed time … however, if the allowed time is “well controlled” it should give the same results … which it is not … from where my assumption of the core occupancy :slight_smile:

But I see the process that run the simulation has not the highest priority on the core it runs onto and thus has an uncertain outcome depending on how many times it is interrupted :slight_smile:

I would love to have an algorithm that can handle hundreds of ennemies and be able to predict around ten step in advance under 100 ms every time … but my code misses clearly (a lot of) optimization :stuck_out_tongue: