#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 |
Incorrect |
227 ms |
504 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
453 ms |
628 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
462 ms |
1588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
484 ms |
2104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
474 ms |
2104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
481 ms |
2104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |