Submission #468927

# Submission time Handle Problem Language Result Execution time Memory
468927 2021-08-30T08:08:31 Z sinamhdv Subtree (INOI20_subtree) C++11
0 / 100
5 ms 5196 KB
#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

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 time Memory Grader output
1 Runtime error 4 ms 5196 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 5196 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5196 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5196 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -