제출 #973783

#제출 시각아이디문제언어결과실행 시간메모리
973783sleepntsheepRelativnost (COCI15_relativnost)C11
0 / 140
1179 ms19864 KiB
#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], tt[N<<1];

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

void pul(int i)
{
    for (int j = 0; j < c; ++j)
    {
        t[i][j] = 0;
        for (int k = 0; k <= j; ++k)
            t[i][j] = (t[i][j] + t[i<<1][k] * 1ll * t[i<<1|1][j-k] % MOD) % MOD;
    }
    tt[i] = tt[i<<1] * 1ll * tt[i<<1|1] % 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);

        int ans = tt[1];
        for (int i = 0; i < c; ++i)
            ans = (ans + MOD - t[1][i]) % MOD;
        printf("%d\n", ans);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

relativnost.c: In function 'main':
relativnost.c:31:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d%d",&n,&c);
      |     ^~~~~~~~~~~~~~~~~~~
relativnost.c:34:33: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |     for (int i = 0; i < n; ++i) scanf("%d%d", a+i, b+i), base(i);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
relativnost.c:37:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     scanf("%d", &q);
      |     ^~~~~~~~~~~~~~~
relativnost.c:40:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         scanf("%d%d%d", &p, &aa, &bb), --p;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...