Submission #82598

# Submission time Handle Problem Language Result Execution time Memory
82598 2018-10-31T14:58:01 Z luciocf Usmjeri (COCI17_usmjeri) C++14
28 / 140
489 ms 2156 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 3e5+10;
const int mod = 1e9+7;

int open[maxn], close[maxn];

int main(void)
{
	int n, m;
	cin >> n >> m;

	for (int i = 1; i <= n-1; i++)
	{
		int a, b;
		cin >> a >> b;
	}

	for (int i = 1; i <= m; i++)
	{
		int a, b;
		cin >> a >> b;

		open[a]++, close[b]++;
	}

	int qtd = 0, x = 0;
	for (int i = 1; i < n; i++)
	{
		qtd -= close[i]; 
		if (!qtd) x++;
		qtd += open[i];
	}

	long long ans = 1;
	for (int i = 1; i <= x; i++)
		ans = (ans*2LL)%mod;

	cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 230 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 489 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 486 ms 1892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 466 ms 2080 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 472 ms 2080 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 462 ms 2156 KB Output isn't correct
2 Halted 0 ms 0 KB -