#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 340
#define mp make_pair
#define mid (l+r)/2
#define le node * 2
#define ri node * 2 + 1
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
#define all(x) x.begin(), x.end()
#define gc getchar_unlocked
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef pair<double,ll>pdi;
const ll inf=1e18;
const ll mod=998244353;
const ld Pi=acos(-1) ;
int n , m , yes ;
ll crnt , ans ;
unordered_map < ll , bool > Mask ;
int a [101] , b [101] , ord [11] ;
int main () {
cin >> n >> m ;
for ( int i = 0 ; i < m ; i ++ ) {
cin >> a [i] >> b [i] ;
a [i] -- , b [i] -- ;
}
for ( int i = 0 ; i < n ; i ++ ) ord [i] = i ;
do {
crnt = 0 ;
for ( ll i = 0 ; i < m ; i ++ ) {
if ( ord [a[i]] < ord [b[i]] ) {
crnt |= ( 1ll << i ) ;
}
}
ans += ( Mask [crnt] == 0 ) * ( __builtin_popcountll (crnt) ) ;
Mask [crnt] = 1 ;
} while ( next_permutation ( ord , ord + n ) ) ;
cout << ans % mod << endl ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
0 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
0 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
256 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
1 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
384 KB |
Output is correct |
31 |
Correct |
2 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
256 KB |
Output is correct |
33 |
Correct |
3 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
512 KB |
Output is correct |
36 |
Correct |
6 ms |
768 KB |
Output is correct |
37 |
Correct |
9 ms |
1280 KB |
Output is correct |
38 |
Correct |
13 ms |
2060 KB |
Output is correct |
39 |
Correct |
12 ms |
256 KB |
Output is correct |
40 |
Correct |
19 ms |
256 KB |
Output is correct |
41 |
Correct |
24 ms |
384 KB |
Output is correct |
42 |
Correct |
31 ms |
512 KB |
Output is correct |
43 |
Correct |
44 ms |
1400 KB |
Output is correct |
44 |
Correct |
57 ms |
2436 KB |
Output is correct |
45 |
Correct |
105 ms |
5016 KB |
Output is correct |
46 |
Correct |
145 ms |
9412 KB |
Output is correct |
47 |
Correct |
209 ms |
15708 KB |
Output is correct |
48 |
Correct |
16 ms |
384 KB |
Output is correct |
49 |
Correct |
23 ms |
512 KB |
Output is correct |
50 |
Correct |
30 ms |
512 KB |
Output is correct |
51 |
Correct |
39 ms |
564 KB |
Output is correct |
52 |
Correct |
127 ms |
360 KB |
Output is correct |
53 |
Correct |
187 ms |
632 KB |
Output is correct |
54 |
Correct |
288 ms |
504 KB |
Output is correct |
55 |
Correct |
438 ms |
2040 KB |
Output is correct |
56 |
Correct |
502 ms |
7996 KB |
Output is correct |
57 |
Correct |
815 ms |
19300 KB |
Output is correct |
58 |
Correct |
1338 ms |
40836 KB |
Output is correct |
59 |
Correct |
1960 ms |
80204 KB |
Output is correct |
60 |
Correct |
2796 ms |
148136 KB |
Output is correct |
61 |
Correct |
158 ms |
376 KB |
Output is correct |
62 |
Correct |
233 ms |
888 KB |
Output is correct |
63 |
Correct |
251 ms |
888 KB |
Output is correct |
64 |
Correct |
316 ms |
892 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
0 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
256 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
1 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
384 KB |
Output is correct |
31 |
Correct |
2 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
256 KB |
Output is correct |
33 |
Correct |
3 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
512 KB |
Output is correct |
36 |
Correct |
6 ms |
768 KB |
Output is correct |
37 |
Correct |
9 ms |
1280 KB |
Output is correct |
38 |
Correct |
13 ms |
2060 KB |
Output is correct |
39 |
Correct |
12 ms |
256 KB |
Output is correct |
40 |
Correct |
19 ms |
256 KB |
Output is correct |
41 |
Correct |
24 ms |
384 KB |
Output is correct |
42 |
Correct |
31 ms |
512 KB |
Output is correct |
43 |
Correct |
44 ms |
1400 KB |
Output is correct |
44 |
Correct |
57 ms |
2436 KB |
Output is correct |
45 |
Correct |
105 ms |
5016 KB |
Output is correct |
46 |
Correct |
145 ms |
9412 KB |
Output is correct |
47 |
Correct |
209 ms |
15708 KB |
Output is correct |
48 |
Correct |
16 ms |
384 KB |
Output is correct |
49 |
Correct |
23 ms |
512 KB |
Output is correct |
50 |
Correct |
30 ms |
512 KB |
Output is correct |
51 |
Correct |
39 ms |
564 KB |
Output is correct |
52 |
Correct |
127 ms |
360 KB |
Output is correct |
53 |
Correct |
187 ms |
632 KB |
Output is correct |
54 |
Correct |
288 ms |
504 KB |
Output is correct |
55 |
Correct |
438 ms |
2040 KB |
Output is correct |
56 |
Correct |
502 ms |
7996 KB |
Output is correct |
57 |
Correct |
815 ms |
19300 KB |
Output is correct |
58 |
Correct |
1338 ms |
40836 KB |
Output is correct |
59 |
Correct |
1960 ms |
80204 KB |
Output is correct |
60 |
Correct |
2796 ms |
148136 KB |
Output is correct |
61 |
Correct |
158 ms |
376 KB |
Output is correct |
62 |
Correct |
233 ms |
888 KB |
Output is correct |
63 |
Correct |
251 ms |
888 KB |
Output is correct |
64 |
Correct |
316 ms |
892 KB |
Output is correct |
65 |
Execution timed out |
3043 ms |
4760 KB |
Time limit exceeded |
66 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
0 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
0 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
256 KB |
Output is correct |
26 |
Correct |
1 ms |
256 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
29 |
Correct |
1 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
384 KB |
Output is correct |
31 |
Correct |
2 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
256 KB |
Output is correct |
33 |
Correct |
3 ms |
384 KB |
Output is correct |
34 |
Correct |
4 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
512 KB |
Output is correct |
36 |
Correct |
6 ms |
768 KB |
Output is correct |
37 |
Correct |
9 ms |
1280 KB |
Output is correct |
38 |
Correct |
13 ms |
2060 KB |
Output is correct |
39 |
Correct |
12 ms |
256 KB |
Output is correct |
40 |
Correct |
19 ms |
256 KB |
Output is correct |
41 |
Correct |
24 ms |
384 KB |
Output is correct |
42 |
Correct |
31 ms |
512 KB |
Output is correct |
43 |
Correct |
44 ms |
1400 KB |
Output is correct |
44 |
Correct |
57 ms |
2436 KB |
Output is correct |
45 |
Correct |
105 ms |
5016 KB |
Output is correct |
46 |
Correct |
145 ms |
9412 KB |
Output is correct |
47 |
Correct |
209 ms |
15708 KB |
Output is correct |
48 |
Correct |
16 ms |
384 KB |
Output is correct |
49 |
Correct |
23 ms |
512 KB |
Output is correct |
50 |
Correct |
30 ms |
512 KB |
Output is correct |
51 |
Correct |
39 ms |
564 KB |
Output is correct |
52 |
Correct |
127 ms |
360 KB |
Output is correct |
53 |
Correct |
187 ms |
632 KB |
Output is correct |
54 |
Correct |
288 ms |
504 KB |
Output is correct |
55 |
Correct |
438 ms |
2040 KB |
Output is correct |
56 |
Correct |
502 ms |
7996 KB |
Output is correct |
57 |
Correct |
815 ms |
19300 KB |
Output is correct |
58 |
Correct |
1338 ms |
40836 KB |
Output is correct |
59 |
Correct |
1960 ms |
80204 KB |
Output is correct |
60 |
Correct |
2796 ms |
148136 KB |
Output is correct |
61 |
Correct |
158 ms |
376 KB |
Output is correct |
62 |
Correct |
233 ms |
888 KB |
Output is correct |
63 |
Correct |
251 ms |
888 KB |
Output is correct |
64 |
Correct |
316 ms |
892 KB |
Output is correct |
65 |
Execution timed out |
3043 ms |
4760 KB |
Time limit exceeded |
66 |
Halted |
0 ms |
0 KB |
- |