답안 #582541

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582541 2022-06-24T04:50:16 Z 반딧불(#8370) Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 162020 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m;
int ex[102], ey[102];
int idx[102];
bool used[102];

unordered_set<ll> st;
int ans;

void dfs(int x){
    if(x==n+1){
//        cout << s << endl;
        ll num=0;
        int cnt = 0;
        for(int i=1; i<=m; i++){
            if(idx[ex[i]] > idx[ey[i]]) num=num*2+1, cnt++;
            else num*=2;
        }
        if(st.find(num) != st.end()) return;
        st.insert(num);
        ans += cnt;
        return;
    }
    for(int i=1; i<=n; i++){
        if(used[i]) continue;
        used[i] = 1;
        idx[i] = x-1;
        dfs(x+1);
        idx[i]=0;
        used[i]=0;
    }
}

int main(){
    scanf("%d %d", &n, &m);
    for(int i=1; i<=m; i++){
        scanf("%d %d", &ex[i], &ey[i]);
    }
    dfs(1);
    printf("%d", ans);
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:40:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
amusementpark.cpp:42:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         scanf("%d %d", &ex[i], &ey[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 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 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 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 212 KB Output is correct
25 Correct 1 ms 212 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 212 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 3 ms 304 KB Output is correct
33 Correct 3 ms 212 KB Output is correct
34 Correct 4 ms 340 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 7 ms 852 KB Output is correct
37 Correct 8 ms 1404 KB Output is correct
38 Correct 10 ms 1840 KB Output is correct
39 Correct 19 ms 212 KB Output is correct
40 Correct 23 ms 212 KB Output is correct
41 Correct 29 ms 360 KB Output is correct
42 Correct 33 ms 464 KB Output is correct
43 Correct 41 ms 1448 KB Output is correct
44 Correct 52 ms 2556 KB Output is correct
45 Correct 73 ms 5308 KB Output is correct
46 Correct 116 ms 10028 KB Output is correct
47 Correct 172 ms 19556 KB Output is correct
48 Correct 22 ms 212 KB Output is correct
49 Correct 38 ms 456 KB Output is correct
50 Correct 32 ms 468 KB Output is correct
51 Correct 34 ms 460 KB Output is correct
52 Correct 222 ms 280 KB Output is correct
53 Correct 258 ms 308 KB Output is correct
54 Correct 327 ms 560 KB Output is correct
55 Correct 363 ms 1564 KB Output is correct
56 Correct 469 ms 9756 KB Output is correct
57 Correct 640 ms 20720 KB Output is correct
58 Correct 1073 ms 43732 KB Output is correct
59 Correct 1521 ms 86312 KB Output is correct
60 Correct 2454 ms 162020 KB Output is correct
61 Correct 294 ms 304 KB Output is correct
62 Correct 327 ms 868 KB Output is correct
63 Correct 372 ms 860 KB Output is correct
64 Correct 338 ms 872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 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 212 KB Output is correct
25 Correct 1 ms 212 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 212 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 3 ms 304 KB Output is correct
33 Correct 3 ms 212 KB Output is correct
34 Correct 4 ms 340 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 7 ms 852 KB Output is correct
37 Correct 8 ms 1404 KB Output is correct
38 Correct 10 ms 1840 KB Output is correct
39 Correct 19 ms 212 KB Output is correct
40 Correct 23 ms 212 KB Output is correct
41 Correct 29 ms 360 KB Output is correct
42 Correct 33 ms 464 KB Output is correct
43 Correct 41 ms 1448 KB Output is correct
44 Correct 52 ms 2556 KB Output is correct
45 Correct 73 ms 5308 KB Output is correct
46 Correct 116 ms 10028 KB Output is correct
47 Correct 172 ms 19556 KB Output is correct
48 Correct 22 ms 212 KB Output is correct
49 Correct 38 ms 456 KB Output is correct
50 Correct 32 ms 468 KB Output is correct
51 Correct 34 ms 460 KB Output is correct
52 Correct 222 ms 280 KB Output is correct
53 Correct 258 ms 308 KB Output is correct
54 Correct 327 ms 560 KB Output is correct
55 Correct 363 ms 1564 KB Output is correct
56 Correct 469 ms 9756 KB Output is correct
57 Correct 640 ms 20720 KB Output is correct
58 Correct 1073 ms 43732 KB Output is correct
59 Correct 1521 ms 86312 KB Output is correct
60 Correct 2454 ms 162020 KB Output is correct
61 Correct 294 ms 304 KB Output is correct
62 Correct 327 ms 868 KB Output is correct
63 Correct 372 ms 860 KB Output is correct
64 Correct 338 ms 872 KB Output is correct
65 Execution timed out 3020 ms 6244 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 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 212 KB Output is correct
25 Correct 1 ms 212 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 212 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 3 ms 304 KB Output is correct
33 Correct 3 ms 212 KB Output is correct
34 Correct 4 ms 340 KB Output is correct
35 Correct 5 ms 468 KB Output is correct
36 Correct 7 ms 852 KB Output is correct
37 Correct 8 ms 1404 KB Output is correct
38 Correct 10 ms 1840 KB Output is correct
39 Correct 19 ms 212 KB Output is correct
40 Correct 23 ms 212 KB Output is correct
41 Correct 29 ms 360 KB Output is correct
42 Correct 33 ms 464 KB Output is correct
43 Correct 41 ms 1448 KB Output is correct
44 Correct 52 ms 2556 KB Output is correct
45 Correct 73 ms 5308 KB Output is correct
46 Correct 116 ms 10028 KB Output is correct
47 Correct 172 ms 19556 KB Output is correct
48 Correct 22 ms 212 KB Output is correct
49 Correct 38 ms 456 KB Output is correct
50 Correct 32 ms 468 KB Output is correct
51 Correct 34 ms 460 KB Output is correct
52 Correct 222 ms 280 KB Output is correct
53 Correct 258 ms 308 KB Output is correct
54 Correct 327 ms 560 KB Output is correct
55 Correct 363 ms 1564 KB Output is correct
56 Correct 469 ms 9756 KB Output is correct
57 Correct 640 ms 20720 KB Output is correct
58 Correct 1073 ms 43732 KB Output is correct
59 Correct 1521 ms 86312 KB Output is correct
60 Correct 2454 ms 162020 KB Output is correct
61 Correct 294 ms 304 KB Output is correct
62 Correct 327 ms 868 KB Output is correct
63 Correct 372 ms 860 KB Output is correct
64 Correct 338 ms 872 KB Output is correct
65 Execution timed out 3020 ms 6244 KB Time limit exceeded
66 Halted 0 ms 0 KB -