Submission #579444

# Submission time Handle Problem Language Result Execution time Memory
579444 2022-06-19T07:26:50 Z temporary_juggernaut Amusement Park (CEOI19_amusementpark) C++14
42 / 100
3000 ms 162028 KB
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
    #define printl(args...) printf(args)
#else
    #define printl(args...) 0
#endif
int x[999],y[999];
ll mod=998244353;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i^m;i++)scanf("%d%d",&x[i],&y[i]);
	unordered_set<ll>st;
	vector<int>vec(n);
	iota(vec.begin(),vec.end(),1);
	ll ans=0;
	do{
		ll tmp=0;
		for(int i=0;i^m;i++)if(vec[x[i]-1]<vec[y[i]-1])tmp|=1ll<<i;
		if(!st.count(tmp)){
			st.insert(tmp);
			ans+=__builtin_popcountll(tmp);
		}
	}while(next_permutation(vec.begin(),vec.end()));
	ans%=mod;
	cout<<ans;
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
amusementpark.cpp:25:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  for(int i=0;i^m;i++)scanf("%d%d",&x[i],&y[i]);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 300 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 1 ms 300 KB Output is correct
33 Correct 2 ms 212 KB Output is correct
34 Correct 3 ms 372 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 6 ms 852 KB Output is correct
37 Correct 9 ms 1364 KB Output is correct
38 Correct 16 ms 1812 KB Output is correct
39 Correct 7 ms 212 KB Output is correct
40 Correct 12 ms 212 KB Output is correct
41 Correct 20 ms 340 KB Output is correct
42 Correct 33 ms 484 KB Output is correct
43 Correct 41 ms 1472 KB Output is correct
44 Correct 52 ms 2600 KB Output is correct
45 Correct 76 ms 5264 KB Output is correct
46 Correct 129 ms 10008 KB Output is correct
47 Correct 211 ms 19540 KB Output is correct
48 Correct 8 ms 212 KB Output is correct
49 Correct 15 ms 432 KB Output is correct
50 Correct 18 ms 432 KB Output is correct
51 Correct 21 ms 468 KB Output is correct
52 Correct 60 ms 284 KB Output is correct
53 Correct 116 ms 312 KB Output is correct
54 Correct 192 ms 576 KB Output is correct
55 Correct 369 ms 1580 KB Output is correct
56 Correct 419 ms 9724 KB Output is correct
57 Correct 758 ms 20688 KB Output is correct
58 Correct 1165 ms 43744 KB Output is correct
59 Correct 1816 ms 86336 KB Output is correct
60 Correct 2554 ms 162028 KB Output is correct
61 Correct 87 ms 296 KB Output is correct
62 Correct 142 ms 960 KB Output is correct
63 Correct 177 ms 752 KB Output is correct
64 Correct 235 ms 816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 300 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 1 ms 300 KB Output is correct
33 Correct 2 ms 212 KB Output is correct
34 Correct 3 ms 372 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 6 ms 852 KB Output is correct
37 Correct 9 ms 1364 KB Output is correct
38 Correct 16 ms 1812 KB Output is correct
39 Correct 7 ms 212 KB Output is correct
40 Correct 12 ms 212 KB Output is correct
41 Correct 20 ms 340 KB Output is correct
42 Correct 33 ms 484 KB Output is correct
43 Correct 41 ms 1472 KB Output is correct
44 Correct 52 ms 2600 KB Output is correct
45 Correct 76 ms 5264 KB Output is correct
46 Correct 129 ms 10008 KB Output is correct
47 Correct 211 ms 19540 KB Output is correct
48 Correct 8 ms 212 KB Output is correct
49 Correct 15 ms 432 KB Output is correct
50 Correct 18 ms 432 KB Output is correct
51 Correct 21 ms 468 KB Output is correct
52 Correct 60 ms 284 KB Output is correct
53 Correct 116 ms 312 KB Output is correct
54 Correct 192 ms 576 KB Output is correct
55 Correct 369 ms 1580 KB Output is correct
56 Correct 419 ms 9724 KB Output is correct
57 Correct 758 ms 20688 KB Output is correct
58 Correct 1165 ms 43744 KB Output is correct
59 Correct 1816 ms 86336 KB Output is correct
60 Correct 2554 ms 162028 KB Output is correct
61 Correct 87 ms 296 KB Output is correct
62 Correct 142 ms 960 KB Output is correct
63 Correct 177 ms 752 KB Output is correct
64 Correct 235 ms 816 KB Output is correct
65 Execution timed out 3061 ms 5696 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 300 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 1 ms 300 KB Output is correct
33 Correct 2 ms 212 KB Output is correct
34 Correct 3 ms 372 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 6 ms 852 KB Output is correct
37 Correct 9 ms 1364 KB Output is correct
38 Correct 16 ms 1812 KB Output is correct
39 Correct 7 ms 212 KB Output is correct
40 Correct 12 ms 212 KB Output is correct
41 Correct 20 ms 340 KB Output is correct
42 Correct 33 ms 484 KB Output is correct
43 Correct 41 ms 1472 KB Output is correct
44 Correct 52 ms 2600 KB Output is correct
45 Correct 76 ms 5264 KB Output is correct
46 Correct 129 ms 10008 KB Output is correct
47 Correct 211 ms 19540 KB Output is correct
48 Correct 8 ms 212 KB Output is correct
49 Correct 15 ms 432 KB Output is correct
50 Correct 18 ms 432 KB Output is correct
51 Correct 21 ms 468 KB Output is correct
52 Correct 60 ms 284 KB Output is correct
53 Correct 116 ms 312 KB Output is correct
54 Correct 192 ms 576 KB Output is correct
55 Correct 369 ms 1580 KB Output is correct
56 Correct 419 ms 9724 KB Output is correct
57 Correct 758 ms 20688 KB Output is correct
58 Correct 1165 ms 43744 KB Output is correct
59 Correct 1816 ms 86336 KB Output is correct
60 Correct 2554 ms 162028 KB Output is correct
61 Correct 87 ms 296 KB Output is correct
62 Correct 142 ms 960 KB Output is correct
63 Correct 177 ms 752 KB Output is correct
64 Correct 235 ms 816 KB Output is correct
65 Execution timed out 3061 ms 5696 KB Time limit exceeded
66 Halted 0 ms 0 KB -