답안 #203802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
203802 2020-02-22T08:03:01 Z dndhk Amusement Park (CEOI19_amusementpark) C++14
19 / 100
3000 ms 33468 KB
#include <bits/stdc++.h>

#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;

const int MAX_N = 30;
const ll MOD = 998244353;

int N, M;
vector<int> gp[MAX_N+1];
vector<pii> edge;
int c[MAX_N+1], idx[MAX_N+1];
ll ans;

vector<ll> vt;

set<ll> st;
void chk(){
	for(int i=1; i<=N; i++)	gp[i].clear();
	ll now = 0;
	for(int i=0; i<M; i++){
		now<<=1LL;
		int u = edge[i].first, v = edge[i].second;
		if(idx[u]<idx[v]){
			int t = u; u = v; v = t;
			now|=1LL;
		}
		gp[u].pb(v);
	}
	vt.pb(now);
}

int per[MAX_N+1];

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		int x, y; scanf("%d%d", &x, &y); edge.pb({x, y});
	}
	for(int i=0; i<N; i++){
		per[i] = i+1;
	}
	while(1){
		for(int i=0; i<N; i++)	idx[per[i]] = i;
		chk();
		if(!next_permutation(per, per+N))	break;
	}
	sort(vt.begin(), vt.end());
	vt.erase(unique(vt.begin(), vt.end()), vt.end());
	for(int i=0; i<vt.size(); i++){
		for(int j=0; j<M; j++){
			ans = (ans + (vt[i]%2LL)) % MOD;
			vt[i]/=2LL;
		}
	}
	cout<<ans;
	return 0;
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:54:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<vt.size(); i++){
               ~^~~~~~~~~~
amusementpark.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
amusementpark.cpp:42:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x, y; scanf("%d%d", &x, &y); edge.pb({x, y});
             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 8 ms 376 KB Output is correct
32 Correct 9 ms 1012 KB Output is correct
33 Correct 11 ms 1012 KB Output is correct
34 Correct 13 ms 1012 KB Output is correct
35 Correct 16 ms 1012 KB Output is correct
36 Correct 20 ms 1012 KB Output is correct
37 Correct 24 ms 1012 KB Output is correct
38 Correct 29 ms 1016 KB Output is correct
39 Correct 47 ms 4584 KB Output is correct
40 Correct 64 ms 4580 KB Output is correct
41 Correct 89 ms 4584 KB Output is correct
42 Correct 100 ms 4580 KB Output is correct
43 Correct 123 ms 4580 KB Output is correct
44 Correct 144 ms 4580 KB Output is correct
45 Correct 187 ms 4580 KB Output is correct
46 Correct 229 ms 4580 KB Output is correct
47 Correct 278 ms 4580 KB Output is correct
48 Correct 63 ms 4580 KB Output is correct
49 Correct 97 ms 4584 KB Output is correct
50 Correct 96 ms 4580 KB Output is correct
51 Correct 95 ms 4580 KB Output is correct
52 Correct 475 ms 33340 KB Output is correct
53 Correct 717 ms 33340 KB Output is correct
54 Correct 908 ms 33340 KB Output is correct
55 Correct 1135 ms 33468 KB Output is correct
56 Correct 1384 ms 33340 KB Output is correct
57 Correct 1668 ms 33328 KB Output is correct
58 Correct 2040 ms 33368 KB Output is correct
59 Correct 2537 ms 33340 KB Output is correct
60 Execution timed out 3085 ms 33372 KB Time limit exceeded
61 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 8 ms 376 KB Output is correct
32 Correct 9 ms 1012 KB Output is correct
33 Correct 11 ms 1012 KB Output is correct
34 Correct 13 ms 1012 KB Output is correct
35 Correct 16 ms 1012 KB Output is correct
36 Correct 20 ms 1012 KB Output is correct
37 Correct 24 ms 1012 KB Output is correct
38 Correct 29 ms 1016 KB Output is correct
39 Correct 47 ms 4584 KB Output is correct
40 Correct 64 ms 4580 KB Output is correct
41 Correct 89 ms 4584 KB Output is correct
42 Correct 100 ms 4580 KB Output is correct
43 Correct 123 ms 4580 KB Output is correct
44 Correct 144 ms 4580 KB Output is correct
45 Correct 187 ms 4580 KB Output is correct
46 Correct 229 ms 4580 KB Output is correct
47 Correct 278 ms 4580 KB Output is correct
48 Correct 63 ms 4580 KB Output is correct
49 Correct 97 ms 4584 KB Output is correct
50 Correct 96 ms 4580 KB Output is correct
51 Correct 95 ms 4580 KB Output is correct
52 Correct 475 ms 33340 KB Output is correct
53 Correct 717 ms 33340 KB Output is correct
54 Correct 908 ms 33340 KB Output is correct
55 Correct 1135 ms 33468 KB Output is correct
56 Correct 1384 ms 33340 KB Output is correct
57 Correct 1668 ms 33328 KB Output is correct
58 Correct 2040 ms 33368 KB Output is correct
59 Correct 2537 ms 33340 KB Output is correct
60 Execution timed out 3085 ms 33372 KB Time limit exceeded
61 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 6 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 6 ms 376 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 8 ms 376 KB Output is correct
32 Correct 9 ms 1012 KB Output is correct
33 Correct 11 ms 1012 KB Output is correct
34 Correct 13 ms 1012 KB Output is correct
35 Correct 16 ms 1012 KB Output is correct
36 Correct 20 ms 1012 KB Output is correct
37 Correct 24 ms 1012 KB Output is correct
38 Correct 29 ms 1016 KB Output is correct
39 Correct 47 ms 4584 KB Output is correct
40 Correct 64 ms 4580 KB Output is correct
41 Correct 89 ms 4584 KB Output is correct
42 Correct 100 ms 4580 KB Output is correct
43 Correct 123 ms 4580 KB Output is correct
44 Correct 144 ms 4580 KB Output is correct
45 Correct 187 ms 4580 KB Output is correct
46 Correct 229 ms 4580 KB Output is correct
47 Correct 278 ms 4580 KB Output is correct
48 Correct 63 ms 4580 KB Output is correct
49 Correct 97 ms 4584 KB Output is correct
50 Correct 96 ms 4580 KB Output is correct
51 Correct 95 ms 4580 KB Output is correct
52 Correct 475 ms 33340 KB Output is correct
53 Correct 717 ms 33340 KB Output is correct
54 Correct 908 ms 33340 KB Output is correct
55 Correct 1135 ms 33468 KB Output is correct
56 Correct 1384 ms 33340 KB Output is correct
57 Correct 1668 ms 33328 KB Output is correct
58 Correct 2040 ms 33368 KB Output is correct
59 Correct 2537 ms 33340 KB Output is correct
60 Execution timed out 3085 ms 33372 KB Time limit exceeded
61 Halted 0 ms 0 KB -