# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973776 | 2024-05-02T10:53:26 Z | sleepntsheep | Relativnost (COCI15_relativnost) | C | 149 ms | 12716 KB |
#include <stdio.h> #define N 100000 #define C 20 const long long MOD = 10007; int power(int a,int b) { if (!b) return 1; int r = power(a, b/2); if(b&1)return r*1ll*r%MOD*a%MOD; return r*1ll*r%MOD; } int q, n, c, a[N], b[N], p, aa, bb; int t[N][C+1], tt[N]; 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); if (c > n) return puts("0"), 0; 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); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2492 KB | Output isn't correct |
2 | Incorrect | 5 ms | 2396 KB | Output isn't correct |
3 | Incorrect | 10 ms | 2396 KB | Output isn't correct |
4 | Incorrect | 149 ms | 12716 KB | Output isn't correct |
5 | Runtime error | 7 ms | 5468 KB | Execution killed with signal 11 |
6 | Runtime error | 6 ms | 5344 KB | Execution killed with signal 11 |
7 | Runtime error | 14 ms | 10332 KB | Execution killed with signal 11 |
8 | Runtime error | 6 ms | 5468 KB | Execution killed with signal 11 |
9 | Runtime error | 10 ms | 9820 KB | Execution killed with signal 11 |
10 | Runtime error | 11 ms | 10192 KB | Execution killed with signal 11 |