Submission #973793

# Submission time Handle Problem Language Result Execution time Memory
973793 2024-05-02T11:00:32 Z sleepntsheep Relativnost (COCI15_relativnost) C
0 / 140
2978 ms 17220 KB
#include <stdio.h>

#define N 100000
#define C 20

const long long MOD = 10007;

int q, n, c, a[N], b[N], p, aa, bb;
int t[N<<1][C+1];

void base(int i)
{
    t[i+n][0] = b[i] % MOD;
    t[i+n][1] = a[i] % MOD;
}

void pul(int i)
{
    for (int j = 0; j <= c; ++j)
        t[i][j] = 0;
    for (int j = 0; j <= c; ++j)
    {
        for (int k = 0; k <= c; ++k)
        {
            int l = j+k<=c?j+k:c;
            t[i][l] = (t[i][l] + t[i<<1][j] * 1ll * t[i<<1|1][k] % MOD) % MOD;
        }
    }
}

int main()
{
    scanf("%d%d",&n,&c);

    for (int i = 0; i < n; ++i) scanf("%d%d", a+i, b+i), base(i);
    for (int i = n; --i;) pul(i);

    scanf("%d", &q);
    while (q--)
    {
        scanf("%d%d%d", &p, &aa, &bb), --p;
        a[p] = aa, b[p] = bb;
        base(p);
        for (p+=n;p>>=1;) pul(p);

        printf("%d\n", t[1][c]);
    }
}

Compilation message

relativnost.c: In function 'main':
relativnost.c:33:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     scanf("%d%d",&n,&c);
      |     ^~~~~~~~~~~~~~~~~~~
relativnost.c:35:33: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |     for (int i = 0; i < n; ++i) scanf("%d%d", a+i, b+i), base(i);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
relativnost.c:38:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |     scanf("%d", &q);
      |     ^~~~~~~~~~~~~~~
relativnost.c:41:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         scanf("%d%d%d", &p, &aa, &bb), --p;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 348 KB Output isn't correct
2 Incorrect 11 ms 576 KB Output isn't correct
3 Incorrect 22 ms 348 KB Output isn't correct
4 Incorrect 324 ms 10324 KB Output isn't correct
5 Incorrect 1220 ms 17072 KB Output isn't correct
6 Incorrect 1852 ms 17220 KB Output isn't correct
7 Incorrect 793 ms 13004 KB Output isn't correct
8 Incorrect 381 ms 16656 KB Output isn't correct
9 Incorrect 730 ms 14788 KB Output isn't correct
10 Incorrect 2978 ms 15216 KB Output isn't correct