organofjohannbach's blog

By organofjohannbach, 12 years ago, In English

declaration:
int nm=0; 
vector<pair<int,int> > tv;
set<pair<int,int> > iset;
int ans[200500][2]={};

Programme A:

for(set<pair<int,int> >::iterator p=iset.begin();cnn++;)
{
    if(p==iset.end())
    {
        puts("No");
        return 0;
    }   
    if((p->first)+1)
        tv.push_back(make_pair((p->first)+1,p->second));
    ++nm;
    ans[nm][0]=member;
    ans[nm][1] = p->second ;
    iset.erase(p++);    
}

this one got Accepted;

However Programme B:
for(set<pair<int,int> >::iterator p=iset.begin();cnn++;++p)
{
    if(p==iset.end())
    {
        puts("No");
        return 0;
    }   
    if((p->first)+1)
        tv.push_back(make_pair((p->first)+1,p->second));
    ++nm;
    ans[nm][0]=member;
    ans[nm][1] = p->second ;
    iset.erase(p);    
}

exit code: -1073741819 RUNTIME_ERROR

What confuse me most is both of two running correctly on my PC;here is some information of my PC:ubuntu 11.10 netbeans 7.0.1

I hope if someone could help me,thanks.

Full text and comments »

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