#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int blc=0,inf=1e9+7;
ll sum[351][351]{0};
priority_queue<pair<int,ll>,vector<pair<int,ll>>,greater<pair<int,ll>>>pq[blc][blc];
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n;cin>>n;pll g[n+1];ll dp[n]={0};dp[0]=1;
for(int i=0;i<n;i++)cin>>g[i].f>>g[i].s;ll ans=0;
for(int i=0;i<n;i++){
/*for(int j=1;j<blc;j++){
while(!pq[i%j][j].empty()&&pq[i%j][j].top().f<i)sum[i%j][j]-=pq[i%j][j].top().s,pq[i%j][j].pop(),sum[i%j][j]%=inf;
}*/
/*for(int j=1;j<blc;j++){
dp[i]+=sum[i%j][j];dp[i]%=inf;
}*/
if(g[i].f>=blc){int cur=i;
for(int j=1;j<=g[i].s;j++){
cur+=g[i].f;if(cur>=n)break;
dp[cur]+=dp[i];dp[cur]%=inf;
}
}
/*else if(g[i].f!=0){
pq[i%g[i].f][g[i].f].push({i+g[i].f*g[i].s,dp[i]});
sum[i%g[i].f][g[i].f]+=dp[i];sum[i%g[i].f][g[i].f]%=inf;
}*/
ans+=dp[i];ans%=inf;
}cout<<(ans%inf+inf)%inf;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
29 ms |
616 KB |
Output is correct |
3 |
Correct |
17 ms |
348 KB |
Output is correct |
4 |
Correct |
59 ms |
600 KB |
Output is correct |
5 |
Correct |
7 ms |
2136 KB |
Output is correct |
6 |
Execution timed out |
2051 ms |
2652 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
565 ms |
1564 KB |
Output is correct |
2 |
Correct |
387 ms |
1372 KB |
Output is correct |
3 |
Execution timed out |
2080 ms |
2652 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |