Submission #1028103

#TimeUsernameProblemLanguageResultExecution timeMemory
1028103mdn2002Trains (BOI24_trains)C++14
Compilation error
0 ms0 KiB
/* Mayoeba Yabureru */ #include<bits/stdc++.h> using namespace std; void solve() { int n, sq = sqrt(1e5); long long mod = 1e9 + 7, ans = 0; cin >> n; vector<int> d(n + 1), x(n + 1); vector<long long> dp(n + 1); vector<vector<int>> remove(n + 1); vector sumdp(sq + 1, vector<long long>(sq + 1)); dp[1] = 1; for (int i = 1; i <= n; i ++) cin >> d[i] >> x[i]; for (int i = 1; i <= n; i ++) { for (int j = 1; j <= sq; j ++) dp[i] = (dp[i] + sumdp[j][i % j]) % mod; ans = (ans + dp[i]) % mod; if (d[i] > sq) { for (int j = i + d[i]; j <= n; j += d[i]) { x[i] --; dp[j] = (dp[j] + dp[i]) % mod; if (x[i] == 0) break; } } else if (d[i]) { sumdp[d[i]][i % d[i]] = (sumdp[d[i]][i % d[i]] + dp[i]) % mod; if (i + x[i] * d[i] <= n) remove[i + x[i] * d[i]].push_back(i); } for (auto j : remove[i]) sumdp[d[j]][j % d[j]] = (sumdp[d[j]][j % d[j]] - dp[j] + mod) % mod; } cout << ans; } /* 5 1 3 2 1 1 3 0 10 3 5 */ int main() { int T = 1; for (int I = 0; I < T; I ++){ solve(); } }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:14:12: error: missing template arguments before 'sumdp'
   14 |     vector sumdp(sq + 1, vector<long long>(sq + 1));
      |            ^~~~~
Main.cpp:19:57: error: 'sumdp' was not declared in this scope
   19 |         for (int j = 1; j <= sq; j ++) dp[i] = (dp[i] + sumdp[j][i % j]) % mod;
      |                                                         ^~~~~
Main.cpp:29:13: error: 'sumdp' was not declared in this scope
   29 |             sumdp[d[i]][i % d[i]] = (sumdp[d[i]][i % d[i]] + dp[i]) % mod;
      |             ^~~~~
Main.cpp:32:34: error: 'sumdp' was not declared in this scope
   32 |         for (auto j : remove[i]) sumdp[d[j]][j % d[j]] = (sumdp[d[j]][j % d[j]] - dp[j] + mod) % mod;
      |                                  ^~~~~