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;
typedef long long lint;
typedef pair<lint, lint> pi;
int n, m, s[22], e[22];
int main(){
cin >> n >> m;
for(int i=0; i<m; i++){
cin >>s[i]>>e[i];
}
if(n > 20 || m > 20){
puts("0");
return 0;
}
if(n == 1) assert(0);
int ans = 0;
for(int i=0; i<(1<<m); i++){
int dx[22] = {};
int ok = 1;
for(int j=0; j<m; j++){
if((i >> j) & 1){
dx[s[j]]++;
dx[e[j]]--;
}
}
for(int i=1; i<n; i++){
dx[i] += dx[i-1];
if(!dx[i]) ok = 0;
}
if(ok) ans++;
}
cout << ans;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |