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

Автор armurox, история, 9 месяцев назад, По-английски

Received the above error when submitting my code, with the qualification "FAIL- Participant has the answer but jury does not (Test Case 393)". This is my first time getting this error, but I assume it is a problem on the checker side. Is there somewhere I can report this? In case this is the place, here is my code:

#include <stdio.h>

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++)
    {
        int n, k;
        scanf("%d%d", &n, &k);
        if (k % 2)
        {
            printf("YES\n");
            for (int j = 1; j < n; j+=2)
            {
                printf("%d %d\n", j, j + 1);
            }
        }

        else
        {
            int num_valid = 0;
            for (int j = 2; j < n + 1; j += 2)
            {
                if (j % 4 > 0 && (j + k) % 4 == 0)
                {
                    num_valid++;
                }
            }
            if (num_valid < n / 4 || k == 0)
            {
                printf("NO\n");
                continue;
            }

            printf("YES\n");
            int max_j = 0;
            for (int j = 1; j < n; j+=2)
            {
                if (j + 3 + 2 * (j / 2) < n + 1)
                {
                    max_j= j;
                    printf("%d %d\n", j, j + (3 + 2 * (j / 2)));
                }

            }

            max_j += 2;
            for (int j = 2; j < n + 1; j+=2)
            {
                if (j % 4 > 0)
                {
                    printf("%d %d\n", j, max_j);
                    max_j += 2;
                }
            }
        }
    }
}

The error came in the second test case run.

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

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by armurox (previous revision, new revision, compare).

»
9 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by armurox (previous revision, new revision, compare).

»
9 месяцев назад, # |
Rev. 3   Проголосовать: нравится -18 Проголосовать: не нравится

It's not a problem from the checker's side. This message means that for a particular test case, your code is printing "NO" while the jury has found that an answer exists. Also, please include the link to the problem in such posts.

Edit: I did not remember the jury message correctly while writing the comment!

  • »
    »
    9 месяцев назад, # ^ |
      Проголосовать: нравится +16 Проголосовать: не нравится

    No? That verdict means that the participant found the answer, but the jury did not. This means that either the jury's solution is wrong or there is some other bug in the system.

»
9 месяцев назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

It seems to be a bug with the checker where it does not check that the pairs actually contain every number exactly once, see this submission: 194882285