Submission #1028030

#TimeUsernameProblemLanguageResultExecution timeMemory
1028030AbitoTrains (BOI24_trains)C++17
0 / 100
44 ms2420 KiB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=1e5+5,M=1e9+7,S=300;
int dp[N],d[N],x[N],n,ans[S+5][S];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>d[i]>>x[i];
    for (int i=n;i;i--){
        dp[i]=1;
        if (d[i]>S){
            for (int j=i+d[i];j<=n;j+=d[i]) dp[i]=(dp[i]+dp[j])%M;
        }
        elif (d[i]){
            dp[i]=(dp[i]+ans[d[i]][i%d[i]])%M;
        }
        for (int j=1;j<=S;j++) ans[j][i%j]=(ans[j][i%j]+dp[i])%M;
    }
    for (int i=1;i<=n;i++) cout<<dp[i]<<' ';cout<<endl;
    cout<<dp[1]<<endl;
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:32:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |     for (int i=1;i<=n;i++) cout<<dp[i]<<' ';cout<<endl;
      |     ^~~
Main.cpp:32:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |     for (int i=1;i<=n;i++) cout<<dp[i]<<' ';cout<<endl;
      |                                             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...