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

Автор transfermarket, 8 месяцев назад, По-английски

252263436

This code memset 3e5 element every testcase.

With 10^4 test case, the number of operation is equal to 3*10^9.

So why does it run in 1.5s. As I know, C++ run 3*10^8 operation every second.

Is it because CF judge is fast?

Note that this is not because the test is weak, test case 3 has 10000 test case. Still, the code can pass this test

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

»
8 месяцев назад, # |
Rev. 4   Проголосовать: нравится +16 Проголосовать: не нравится

$$$3*10^8$$$ operations per second is a good "rule-of-thumb" guideline. In practice things are more complicated and it depends on the operations.

Generally memset is extremely fast, even if linear asymptotically. Depending on the compiler/architecture it may do less operations (if zeroing chunks of bytes at once is supported by the architecture), or it may just do the operations much faster by levering some low-level optimizations due to the simplicity of the operation.

In a nutshell, memseting $$$3*10^9$$$ in 1.6s sounds very plausible.