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

Автор Marine7, история, 9 лет назад, По-английски

On POI, there is a special testing environment, which assumes equal execution time of every instruction (one clock cycle each), the count of the cycles is then divided by some number which mimicates the real CPU cycle capabilities, to get the runtime.

Could you (specifically in C++) take somehow advantage of this testing system property, and write your programs in a style, which generally uses more costly instructions, but fewer of them, as to make the execution time faster in this environment?

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

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can you please elaborate on which judge this is? It seems very strange, what does the phrase "assume equal time of every instruction" mean? They look at how many instructions you make? What is an instruction defined as? It would be nice if you can elaborate. Thanks.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Is the list of "instructions" that count as one clock cycle available?

Sending data to disk and allocating memory would be the most costly operations I can think of right now: -Creating a lot of pointers (this is seen in implementations like an implicit segment tree in an array or a explicit segment tree with pointers, where getting a chunk of memory (array) at once is more efficient) -Flushing data to disk with cin and cout (if this counts as one cycle, you can use cin and cout instead of scanf and printf aka fast I/O without penalty (or just don't have to use the cin.tie, cout.tie, sync_with_io... lines)

Other than those, there would be microoptimizations like: -x << 2 is faster than x * 2