# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
203799 | 2020-02-22T07:59:16 Z | dndhk | Amusement Park (CEOI19_amusementpark) | C++14 | 3000 ms | 33544 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++) while(!gp[i].empty()) gp[i].pop_back(); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 6 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 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 | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 6 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 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 | 428 KB | Output is correct |
31 | Correct | 7 ms | 376 KB | Output is correct |
32 | Correct | 10 ms | 1008 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 14 ms | 1012 KB | Output is correct |
35 | Correct | 17 ms | 1012 KB | Output is correct |
36 | Correct | 21 ms | 1012 KB | Output is correct |
37 | Correct | 25 ms | 1012 KB | Output is correct |
38 | Correct | 30 ms | 1012 KB | Output is correct |
39 | Correct | 51 ms | 4580 KB | Output is correct |
40 | Correct | 70 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 106 ms | 4580 KB | Output is correct |
43 | Correct | 126 ms | 4580 KB | Output is correct |
44 | Correct | 151 ms | 4580 KB | Output is correct |
45 | Correct | 186 ms | 4628 KB | Output is correct |
46 | Correct | 226 ms | 4580 KB | Output is correct |
47 | Correct | 283 ms | 4580 KB | Output is correct |
48 | Correct | 67 ms | 4712 KB | Output is correct |
49 | Correct | 99 ms | 4572 KB | Output is correct |
50 | Correct | 98 ms | 4580 KB | Output is correct |
51 | Correct | 99 ms | 4584 KB | Output is correct |
52 | Correct | 511 ms | 33340 KB | Output is correct |
53 | Correct | 724 ms | 33212 KB | Output is correct |
54 | Correct | 944 ms | 33468 KB | Output is correct |
55 | Correct | 1156 ms | 33316 KB | Output is correct |
56 | Correct | 1424 ms | 33540 KB | Output is correct |
57 | Correct | 1707 ms | 33340 KB | Output is correct |
58 | Correct | 2074 ms | 33348 KB | Output is correct |
59 | Correct | 2573 ms | 33544 KB | Output is correct |
60 | Execution timed out | 3088 ms | 33340 KB | Time limit exceeded |
61 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 6 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 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 | 428 KB | Output is correct |
31 | Correct | 7 ms | 376 KB | Output is correct |
32 | Correct | 10 ms | 1008 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 14 ms | 1012 KB | Output is correct |
35 | Correct | 17 ms | 1012 KB | Output is correct |
36 | Correct | 21 ms | 1012 KB | Output is correct |
37 | Correct | 25 ms | 1012 KB | Output is correct |
38 | Correct | 30 ms | 1012 KB | Output is correct |
39 | Correct | 51 ms | 4580 KB | Output is correct |
40 | Correct | 70 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 106 ms | 4580 KB | Output is correct |
43 | Correct | 126 ms | 4580 KB | Output is correct |
44 | Correct | 151 ms | 4580 KB | Output is correct |
45 | Correct | 186 ms | 4628 KB | Output is correct |
46 | Correct | 226 ms | 4580 KB | Output is correct |
47 | Correct | 283 ms | 4580 KB | Output is correct |
48 | Correct | 67 ms | 4712 KB | Output is correct |
49 | Correct | 99 ms | 4572 KB | Output is correct |
50 | Correct | 98 ms | 4580 KB | Output is correct |
51 | Correct | 99 ms | 4584 KB | Output is correct |
52 | Correct | 511 ms | 33340 KB | Output is correct |
53 | Correct | 724 ms | 33212 KB | Output is correct |
54 | Correct | 944 ms | 33468 KB | Output is correct |
55 | Correct | 1156 ms | 33316 KB | Output is correct |
56 | Correct | 1424 ms | 33540 KB | Output is correct |
57 | Correct | 1707 ms | 33340 KB | Output is correct |
58 | Correct | 2074 ms | 33348 KB | Output is correct |
59 | Correct | 2573 ms | 33544 KB | Output is correct |
60 | Execution timed out | 3088 ms | 33340 KB | Time limit exceeded |
61 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 4 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 6 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 4 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 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 | 428 KB | Output is correct |
31 | Correct | 7 ms | 376 KB | Output is correct |
32 | Correct | 10 ms | 1008 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 14 ms | 1012 KB | Output is correct |
35 | Correct | 17 ms | 1012 KB | Output is correct |
36 | Correct | 21 ms | 1012 KB | Output is correct |
37 | Correct | 25 ms | 1012 KB | Output is correct |
38 | Correct | 30 ms | 1012 KB | Output is correct |
39 | Correct | 51 ms | 4580 KB | Output is correct |
40 | Correct | 70 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 106 ms | 4580 KB | Output is correct |
43 | Correct | 126 ms | 4580 KB | Output is correct |
44 | Correct | 151 ms | 4580 KB | Output is correct |
45 | Correct | 186 ms | 4628 KB | Output is correct |
46 | Correct | 226 ms | 4580 KB | Output is correct |
47 | Correct | 283 ms | 4580 KB | Output is correct |
48 | Correct | 67 ms | 4712 KB | Output is correct |
49 | Correct | 99 ms | 4572 KB | Output is correct |
50 | Correct | 98 ms | 4580 KB | Output is correct |
51 | Correct | 99 ms | 4584 KB | Output is correct |
52 | Correct | 511 ms | 33340 KB | Output is correct |
53 | Correct | 724 ms | 33212 KB | Output is correct |
54 | Correct | 944 ms | 33468 KB | Output is correct |
55 | Correct | 1156 ms | 33316 KB | Output is correct |
56 | Correct | 1424 ms | 33540 KB | Output is correct |
57 | Correct | 1707 ms | 33340 KB | Output is correct |
58 | Correct | 2074 ms | 33348 KB | Output is correct |
59 | Correct | 2573 ms | 33544 KB | Output is correct |
60 | Execution timed out | 3088 ms | 33340 KB | Time limit exceeded |
61 | Halted | 0 ms | 0 KB | - |