Submission #468927

#TimeUsernameProblemLanguageResultExecution timeMemory
468927sinamhdvSubtree (INOI20_subtree)C++11
0 / 100
5 ms5196 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int mod = 1000 * 1000 * 1000 + 7; const int INF = 1e9 + 100; const ll LINF = 1e18 + 100; #ifdef DEBUG #define dbg(x) cout << #x << " = " << (x) << endl << flush; #define dbgr(s, f) { cout << #s << ": "; for (auto _ = (s); _ != (f); _++) cout << *_ << ' '; cout << endl << flush; } #else #define dbg(x) ; #define dbgr(s, f) ; #endif #define fast_io ios::sync_with_stdio(0); cin.tie(0); #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define all(x) (x).begin(), (x).end() #define pb push_back #define fr first #define sc second #define endl '\n' const int MAXN = 100100; const int MAXE = 150100; int n, m; vector<int> adj[MAXN]; int dp[MAXN][2]; void dfs(int v, int par) { int cur = 1; for (int u : adj[v]) if (u != par) { dfs(u, v); cur = (ll)cur * (dp[u][1] + 1) % mod; dp[v][0] = (dp[v][0] + dp[u][0]) % mod; } dp[v][1] = cur; dp[v][0] = (dp[v][0] + cur) % mod; } int32_t main(void) { fast_io; cin >> n >> m; FOR(i, 0, m) { int x, y; cin >> x >> y; adj[x].pb(y); adj[y].pb(x); } dp[MAXE * 2][0] = 1; cout << dp[1][0] << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:58:13: warning: array subscript 300200 is above array bounds of 'int [100100][2]' [-Warray-bounds]
   58 |  dp[MAXE * 2][0] = 1;
      |  ~~~~~~~~~~~^
Main.cpp:31:5: note: while referencing 'dp'
   31 | int dp[MAXN][2];
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...