ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2049. Chemistry

Show all messages Hide all messages

this is my checker of this problem, it can't be wrong ,but WA on test 8

    if(i>=n||a[i]!=k)
    {
        while(!(n==5&&k==5))
           puts("orz");
       puts("-1");
        }
    else
    {
        printf("%d\n",cnt_ans);
        while(cnt_ans>3*n)
           puts("orz");
        for(i=0;i<cnt_ans;i++)
           printf("%d %d\n",ax[i],ay[i]);
        for(i=0;i<n;i++)
            a[i]=1;
        for(i=0;i<cnt_ans;i++)
        {
            int id1=ax[i]-1,id2=ay[i]-1;
            while(id1>=n||id1<0||id2>=n||id2<0||id1==id2)
               puts("orz");
            a[id1]-=a[id2];
            a[id2]*=2;
            while(a[id1]<0)
               puts("orz");
        }
        for(i=0;i<n;i++)
        {
            if(a[i]==k)
               break;
        }
        while(i!=0)
           puts("orz");
    }
it doesn't give ole but WA on test 8
sorry it's my mistake there is another no solution judge beforce this code...