This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10;
int n;
int a[N], b[N];
int answer;
int d[N];
void recursion(int it, int x) {
if (it > n) {
answer += 1;
return;
}
recursion(it + 1, x);
for (int i = max(a[it], x + 1); i <= b[it]; ++i) recursion(it + 1, i);
}
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i];
recursion(1, 0);
cout << answer - 1 << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |