Блог пользователя Intuition2.0

Автор Intuition2.0, история, 3 недели назад, По-английски

With respect to this problem : 2050G - Tree Destruction

Using vector of vector, compiled successfully and giving correct output
But when trying the same with array of vectors, it doesn't compile

Error by compiler -> error: use of deleted function 'main()::<lambda(auto:28, int, int)>::~<lambda>()' <lambda(auto:28, int, int)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:

I want to know why this is happening. Can someone please tell me the reason behind this unknown behavior of lambda function ?

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

»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Intuition2.0 (previous revision, new revision, compare).

»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Intuition2.0 (previous revision, new revision, compare).

»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

An array of size n requires the n to be a compile-time constant while the vector is dynamically sized.

If you provide n at runtime with std::cin, the compiler does not know its value when constructing the array, leading to a compilation error.

This code 295344654 compiles fine, although TLEs because we are using global initialisation for a big graph for each test case, hence use a vector of vector for the graph in this situation 295345367