Submission #973793

#TimeUsernameProblemLanguageResultExecution timeMemory
973793sleepntsheepRelativnost (COCI15_relativnost)C11
0 / 140
2978 ms17220 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+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 (stderr)

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 timeMemoryGrader output
Fetching results...