# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
448786 | IvnF | Relativnost (COCI15_relativnost) | C++14 | 4051 ms | 16480 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define fi first
#define se second
#define ld long double
const ll mod=10007;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n, c, q;
cin >> n >> c;
ll dp[1005][1005], a[1005], b[1005];
for(int i=1;i<=n;++i){
cin >> a[i];
}
for(int i=1;i<=n;++i){
cin >> b[i];
}
cin >> q;
while(q--){
ll idx, ai, bi; cin >> idx >> ai >> bi;
a[idx]=ai;
b[idx]=bi;
memset(dp, 0, sizeof dp);
dp[0][0]=1;
for(int i=1;i<=n;++i){
dp[i][0]=b[i]%mod;
}
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
dp[i][j]=((b[i]*dp[i-1][j])%mod+(a[i]*dp[i-1][j-1])%mod)%mod;
}
}
ll ans=0;
for(int j=c;j<=n;++j){
ans+=dp[n][j];
ans%=mod;
}
cout << ans << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |