CantLoseNow's blog

By CantLoseNow, history, 2 months ago, In English

200A - Cinema — i was solving this problem which was in a20j ladder A(No.100) . And i solved it using brute force using this submission 173330360 . it worked for all testcases in my computer but on codeforces it went to an error of wrong answer. the input was totally same. i even tried an online compiler and that website gave me an even different answer than both of the previous answers. please help me. i know the solution is kinda messed up since i just started competitive programming but please i need help.

  • Vote: I like it
  • -1
  • Vote: I do not like it

2 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

in line number 22 you wrote int hall[row][col] = {0}; well, this is wrong if you want to make your whole array equal to 0 you can do a for loop like this :

for(int i = 0; i < row; i++)
    for(int j = 0; j < col; j++)
        hall[i][j] = 0;

if you do this your output will be correct.

  • »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Bro you are a lifesaver. Although the time limit exceeded on test case 8 (which was obvious), you helped me a lot. i wasted my entire day for the answer. Hope you get what you want in your life.

  • »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    memset() better and faster then loop if he just want it by zero or -1, or u can create array in global and it will be initialize automatically by zero.