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

Автор rajkumar62506, история, 5 лет назад, По-английски

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?

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

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится
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.

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +24 Проголосовать: не нравится

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