제출 #1125041

#제출 시각아이디문제언어결과실행 시간메모리
1125041VMaksimoski008Relativnost (COCI15_relativnost)C++17
0 / 140
3347 ms15756 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e4 + 7; int tree[200005][21], n, c; void update(int p, int a, int b) { p += n; tree[p][0] = b; tree[p][1] = a; for(; p>1; p>>=1) { for(int i=0; i<=c; i++) tree[p>>1][i] = 0; for(int i=0; i<=c; i++) for(int j=0; j<=c; j++) tree[p>>1][min(c,i+j)] = (tree[p>>1][min(c,i+j)] + tree[p][i] * tree[p^1][j]) % mod; } } signed main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); cin >> n >> c; for(int i=0; i<n; i++) { int a, b; cin >> a >> b; update(i, a, b); } int q; cin >> q; while(q--) { int p, a, b; cin >> p >> a >> b; update(p-1, a, b); cout << tree[1][c] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...