sarthak11yadav's blog

By sarthak11yadav, 3 years ago, In English

This is related to todays contest Codeforces Round #679 (Div. 2, based on Technocup 2021 Elimination Round 1). I ran my code for problem B. A New Technique on codechef ide for the example input given in the question and it gave a correct output but when i ran the same code on codeforces it gave WRONG ANSWER on the same test case and I was unable to find where is the problem and as a result it really badly effected my todays standings.

So if there is any loophole in the code itself please let me know as , i really wanted to know what's the problem in the code.

Or if there is a problem on the setters side please fix it as its really destroyed my contest today.

And at last the code ran with just changing my template for loop , i don't know why this happened.

If you know the problem please let me know as i'm really frustrated by this thing and my rating will also go down.

I'm pasting the code also here.

int main() { ll i, j, k, n, m, ct = 0, ans = 0;

tc {

    cin >> n >> m;
    ll b[1000];
    ll r[n][m], c[m][n];
    fo(i,n,0)
       fo(j,m,0)
           cin>>r[i][j];
    fo(i,m,0)
       fo(j,n,0)
           cin>>c[i][j];


    fo(i,m,0) {
        ll j;
       k = c[i][0];
       ll fu = 0;
       fo(j,n,0) {
         if (k == r[j][0]) {
          b[0] = j;
          fu = 1;
          break;
         }
       }
       ct = 1;
       if (fu == 1) {
         fo(i,n,1) {
          k = c[i][j];
          fo(x,n,0) {
              if (k == r[x][0]) {
                 b[ct] = x;
                 ct++;
                 break;
              }
          }
         }
       }
    }


    fo(i,n,0) {

       k = b[i];

       fo(j,m,0) 
           cout<<r[k][j]<< " ";

       cout << endl;
    }

}

}

  • Vote: I like it
  • -31
  • Vote: I do not like it