Submission #82597

#TimeUsernameProblemLanguageResultExecution timeMemory
82597luciocfUsmjeri (COCI17_usmjeri)C++14
0 / 140
484 ms2104 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...