#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5+10;
const int mod = 1e9+7;
bool 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] = 1, close[b] = 1;
}
int qtd = 0, x = 0;
for (int i = 1; i < n; i++)
{
if (close[i]) qtd--;
if (!qtd) x++;
if (open[i]) qtd++;
}
long long ans = 1;
for (int i = 1; i <= x; i++)
ans = (ans*2)%mod;
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
209 ms |
376 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
431 ms |
516 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
451 ms |
1040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
438 ms |
1060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
474 ms |
1060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
509 ms |
1072 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |