#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
236 KB |
Output is correct |
2 |
Correct |
145 ms |
256 KB |
Output is correct |
3 |
Correct |
129 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
99 ms |
256 KB |
Output is correct |
7 |
Correct |
15 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
308 KB |
Output is correct |
10 |
Correct |
63 ms |
308 KB |
Output is correct |
11 |
Correct |
124 ms |
344 KB |
Output is correct |
12 |
Correct |
50 ms |
344 KB |
Output is correct |
13 |
Correct |
132 ms |
344 KB |
Output is correct |
14 |
Correct |
127 ms |
344 KB |
Output is correct |
15 |
Correct |
114 ms |
344 KB |
Output is correct |
16 |
Correct |
118 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
236 KB |
Output is correct |
2 |
Correct |
145 ms |
256 KB |
Output is correct |
3 |
Correct |
129 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
99 ms |
256 KB |
Output is correct |
7 |
Correct |
15 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
308 KB |
Output is correct |
10 |
Correct |
63 ms |
308 KB |
Output is correct |
11 |
Correct |
124 ms |
344 KB |
Output is correct |
12 |
Correct |
50 ms |
344 KB |
Output is correct |
13 |
Correct |
132 ms |
344 KB |
Output is correct |
14 |
Correct |
127 ms |
344 KB |
Output is correct |
15 |
Correct |
114 ms |
344 KB |
Output is correct |
16 |
Correct |
118 ms |
344 KB |
Output is correct |
17 |
Incorrect |
2 ms |
344 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Runtime error |
2 ms |
368 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
236 KB |
Output is correct |
2 |
Correct |
145 ms |
256 KB |
Output is correct |
3 |
Correct |
129 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
99 ms |
256 KB |
Output is correct |
7 |
Correct |
15 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
308 KB |
Output is correct |
10 |
Correct |
63 ms |
308 KB |
Output is correct |
11 |
Correct |
124 ms |
344 KB |
Output is correct |
12 |
Correct |
50 ms |
344 KB |
Output is correct |
13 |
Correct |
132 ms |
344 KB |
Output is correct |
14 |
Correct |
127 ms |
344 KB |
Output is correct |
15 |
Correct |
114 ms |
344 KB |
Output is correct |
16 |
Correct |
118 ms |
344 KB |
Output is correct |
17 |
Incorrect |
2 ms |
344 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
94 ms |
236 KB |
Output is correct |
2 |
Correct |
145 ms |
256 KB |
Output is correct |
3 |
Correct |
129 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
99 ms |
256 KB |
Output is correct |
7 |
Correct |
15 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
308 KB |
Output is correct |
10 |
Correct |
63 ms |
308 KB |
Output is correct |
11 |
Correct |
124 ms |
344 KB |
Output is correct |
12 |
Correct |
50 ms |
344 KB |
Output is correct |
13 |
Correct |
132 ms |
344 KB |
Output is correct |
14 |
Correct |
127 ms |
344 KB |
Output is correct |
15 |
Correct |
114 ms |
344 KB |
Output is correct |
16 |
Correct |
118 ms |
344 KB |
Output is correct |
17 |
Incorrect |
2 ms |
344 KB |
- |