rajkumar62506's blog

By rajkumar62506, history, 4 years ago, In English

Hello! In my submission 80851257 to the problem E. Graph Coloring I'm getting RUNTIME_ERROR with Exit Code -1073741819. I don't know what's wrong with my code? I tried in my IDE it's working fine, Also I run same code on online IDE:Can see here and it's running fine but it is giving RUNTIME_ERROR on CF.Can Anyone Explain?

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

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it
int i=r,j=c;
while(i>0){
    if(dp[i-1][j-a[i].size()]==1){
        for(int ii=0;ii<a[i].size();ii++){
            color[a[i-1][ii]]=2;
        }
        j-=a[i].size();
    }
    else{
        for(int ii=0;ii<b[i].size();ii++){
            color[b[i-1][ii]]=2;
        }
        j-=b[i].size();
    }
    i--;
}

In this block when i=r, a[i].size() and b[i].size() gives the runtime error as a[r] and b[r] is out of bound for a and b. Change that to a[i-1] and b[i-1] and it should work without RTE.

»
4 years ago, # |
Rev. 2   Vote: I like it +24 Vote: I do not like it

$$$-1073741819 = -(2^{30})+5$$$. Add $$$2^{30} + 5$$$ to your program and it will exit with code 0, so it will be correct.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    And where to add 2^30+5 ?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +22 Vote: I do not like it

      In the part responsible for the exit code.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        But which part?And How to add that?

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +10 Vote: I do not like it

          Check for global variables in program. You will find one with exit code. Just Add It.

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Actually one line in program was exceeding vector size that was creating problem.I don't how your method can solve that?

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +12 Vote: I do not like it

          #define addToExiTCode (1<<30)+5

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Python Equivalent:- globals()["exitCode"] += 2**30 + 5

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              But problem was with exceeding vector size? how this can help to that?

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
            Rev. 2   Vote: I like it +5 Vote: I do not like it

            #define exit( exit(1<<30+5+
            #define return return 1<<30+5+