rajkumar62506's blog

By rajkumar62506, history, 6 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

»
6 years ago, hide # |
 
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.

»
6 years ago, hide # |
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.