답안 #997893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997893 2024-06-13T05:00:06 Z imarn Trains (BOI24_trains) C++14
21 / 100
2000 ms 2652 KB
#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=1,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 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 360 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 360 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 6 ms 604 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 696 KB Output is correct
23 Correct 29 ms 612 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 604 KB Output is correct
26 Correct 19 ms 564 KB Output is correct
27 Correct 59 ms 600 KB Output is correct
28 Correct 11 ms 604 KB Output is correct
29 Correct 81 ms 604 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 41 ms 672 KB Output is correct
32 Correct 88 ms 600 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 692 KB Output is correct
36 Correct 5 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 29 ms 612 KB Output is correct
3 Correct 17 ms 348 KB Output is correct
4 Correct 59 ms 856 KB Output is correct
5 Correct 7 ms 2136 KB Output is correct
6 Execution timed out 2029 ms 2652 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 560 ms 1372 KB Output is correct
2 Correct 395 ms 1372 KB Output is correct
3 Execution timed out 2084 ms 2652 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 360 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 6 ms 604 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 696 KB Output is correct
23 Correct 29 ms 612 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 604 KB Output is correct
26 Correct 19 ms 564 KB Output is correct
27 Correct 59 ms 600 KB Output is correct
28 Correct 11 ms 604 KB Output is correct
29 Correct 81 ms 604 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 41 ms 672 KB Output is correct
32 Correct 88 ms 600 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 692 KB Output is correct
36 Correct 5 ms 604 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 29 ms 612 KB Output is correct
39 Correct 17 ms 348 KB Output is correct
40 Correct 59 ms 856 KB Output is correct
41 Correct 7 ms 2136 KB Output is correct
42 Execution timed out 2029 ms 2652 KB Time limit exceeded
43 Halted 0 ms 0 KB -