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

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

Problem : https://codeforces.com/edu/course/2/lesson/4/4/practice/contest/274684/problem/B


My submissions:
- Using Vectors: https://ideone.com/eZXWMF
- Using Arrays : https://ideone.com/nSlABV

Can anyone help me in determining the root cause for the TLE verdict? The inspiration of using Arrays instead of Vectors came from : https://codeforces.com/edu/course/2/lesson/4/4/practice?#comment-661428

EDIT: Using a struct matrix instead of a 2D array gave AC. Code : https://ideone.com/w3Mnl7

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

»
22 месяца назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Lucky

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

vector has a much larger constant than array(as far as I know) so try avoid using it.

  • »
    »
    22 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    But using arrays also gives TLE. I wonder what I'm doing wrong (besides making a blog about it).

  • »
    »
    22 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    That is not true actually, atleast when using operator[] instead of .at()

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

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