Submission #829720

# Submission time Handle Problem Language Result Execution time Memory
829720 2023-08-18T14:27:37 Z FatihSolak Duathlon (APIO18_duathlon) C++17
5 / 100
1000 ms 59920 KB
#include <bits/stdc++.h>
#define N 100005
using namespace std;
int ok[100][100];
void solve(){
    int n,m;
    cin >> n >> m;
    for(int i = 1;i<=m;i++){
        int u,v;
        cin >> u >> v;
        ok[u-1][v-1] = ok[v-1][u-1] = 1;
    }
    int ans = 0;
    for(int a = 0;a<n;a++){
        for(int b = 0;b<n;b++){
            for(int c = 0;c<n;c++){
                if(a == b || b == c || a == c)
                    continue;
                vector<vector<int>> cnt((1<<n),vector<int> (n,0));
                cnt[(1<<a)][a] = 1;
                bool f = 0;
                for(int mask = 0;mask < (1<<n);mask++){
                    for(int i = 0;i<n;i++){
                        if(cnt[mask][i] == 0)continue;
                        if(cnt[mask][i] == 3)
                            f = 1;
                        for(int to = 0;to<n;to++){
                            if(mask & (1<<to))
                                continue;
                            if(ok[i][to] == 0)
                                continue;
                            int num = cnt[mask][i];
                            if(num == 2 && to == c)
                                num++;
                            if(num == 1 && to == b)
                                num++;
                            cnt[mask + (1<<to)][to] = max(cnt[mask + (1<<to)][to],num);
                        }
                    }
                }
                ans += f;
            }
        }
    }
    cout << ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef Local    
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 27 ms 376 KB Output is correct
7 Correct 26 ms 320 KB Output is correct
8 Correct 42 ms 328 KB Output is correct
9 Correct 103 ms 340 KB Output is correct
10 Correct 119 ms 392 KB Output is correct
11 Correct 34 ms 340 KB Output is correct
12 Correct 35 ms 380 KB Output is correct
13 Correct 29 ms 340 KB Output is correct
14 Correct 30 ms 404 KB Output is correct
15 Correct 31 ms 340 KB Output is correct
16 Correct 26 ms 384 KB Output is correct
17 Correct 35 ms 296 KB Output is correct
18 Correct 33 ms 380 KB Output is correct
19 Correct 36 ms 340 KB Output is correct
20 Correct 36 ms 340 KB Output is correct
21 Correct 32 ms 340 KB Output is correct
22 Correct 29 ms 384 KB Output is correct
23 Correct 10 ms 368 KB Output is correct
24 Correct 5 ms 332 KB Output is correct
25 Correct 10 ms 364 KB Output is correct
26 Correct 45 ms 380 KB Output is correct
27 Correct 5 ms 340 KB Output is correct
28 Correct 13 ms 328 KB Output is correct
29 Correct 42 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 16 ms 368 KB Output is correct
32 Correct 33 ms 384 KB Output is correct
33 Correct 13 ms 364 KB Output is correct
34 Correct 15 ms 324 KB Output is correct
35 Correct 40 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 27 ms 376 KB Output is correct
7 Correct 26 ms 320 KB Output is correct
8 Correct 42 ms 328 KB Output is correct
9 Correct 103 ms 340 KB Output is correct
10 Correct 119 ms 392 KB Output is correct
11 Correct 34 ms 340 KB Output is correct
12 Correct 35 ms 380 KB Output is correct
13 Correct 29 ms 340 KB Output is correct
14 Correct 30 ms 404 KB Output is correct
15 Correct 31 ms 340 KB Output is correct
16 Correct 26 ms 384 KB Output is correct
17 Correct 35 ms 296 KB Output is correct
18 Correct 33 ms 380 KB Output is correct
19 Correct 36 ms 340 KB Output is correct
20 Correct 36 ms 340 KB Output is correct
21 Correct 32 ms 340 KB Output is correct
22 Correct 29 ms 384 KB Output is correct
23 Correct 10 ms 368 KB Output is correct
24 Correct 5 ms 332 KB Output is correct
25 Correct 10 ms 364 KB Output is correct
26 Correct 45 ms 380 KB Output is correct
27 Correct 5 ms 340 KB Output is correct
28 Correct 13 ms 328 KB Output is correct
29 Correct 42 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 16 ms 368 KB Output is correct
32 Correct 33 ms 384 KB Output is correct
33 Correct 13 ms 364 KB Output is correct
34 Correct 15 ms 324 KB Output is correct
35 Correct 40 ms 384 KB Output is correct
36 Execution timed out 1056 ms 59920 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 488 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 27 ms 376 KB Output is correct
7 Correct 26 ms 320 KB Output is correct
8 Correct 42 ms 328 KB Output is correct
9 Correct 103 ms 340 KB Output is correct
10 Correct 119 ms 392 KB Output is correct
11 Correct 34 ms 340 KB Output is correct
12 Correct 35 ms 380 KB Output is correct
13 Correct 29 ms 340 KB Output is correct
14 Correct 30 ms 404 KB Output is correct
15 Correct 31 ms 340 KB Output is correct
16 Correct 26 ms 384 KB Output is correct
17 Correct 35 ms 296 KB Output is correct
18 Correct 33 ms 380 KB Output is correct
19 Correct 36 ms 340 KB Output is correct
20 Correct 36 ms 340 KB Output is correct
21 Correct 32 ms 340 KB Output is correct
22 Correct 29 ms 384 KB Output is correct
23 Correct 10 ms 368 KB Output is correct
24 Correct 5 ms 332 KB Output is correct
25 Correct 10 ms 364 KB Output is correct
26 Correct 45 ms 380 KB Output is correct
27 Correct 5 ms 340 KB Output is correct
28 Correct 13 ms 328 KB Output is correct
29 Correct 42 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 16 ms 368 KB Output is correct
32 Correct 33 ms 384 KB Output is correct
33 Correct 13 ms 364 KB Output is correct
34 Correct 15 ms 324 KB Output is correct
35 Correct 40 ms 384 KB Output is correct
36 Execution timed out 1056 ms 59920 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 27 ms 376 KB Output is correct
7 Correct 26 ms 320 KB Output is correct
8 Correct 42 ms 328 KB Output is correct
9 Correct 103 ms 340 KB Output is correct
10 Correct 119 ms 392 KB Output is correct
11 Correct 34 ms 340 KB Output is correct
12 Correct 35 ms 380 KB Output is correct
13 Correct 29 ms 340 KB Output is correct
14 Correct 30 ms 404 KB Output is correct
15 Correct 31 ms 340 KB Output is correct
16 Correct 26 ms 384 KB Output is correct
17 Correct 35 ms 296 KB Output is correct
18 Correct 33 ms 380 KB Output is correct
19 Correct 36 ms 340 KB Output is correct
20 Correct 36 ms 340 KB Output is correct
21 Correct 32 ms 340 KB Output is correct
22 Correct 29 ms 384 KB Output is correct
23 Correct 10 ms 368 KB Output is correct
24 Correct 5 ms 332 KB Output is correct
25 Correct 10 ms 364 KB Output is correct
26 Correct 45 ms 380 KB Output is correct
27 Correct 5 ms 340 KB Output is correct
28 Correct 13 ms 328 KB Output is correct
29 Correct 42 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
31 Correct 16 ms 368 KB Output is correct
32 Correct 33 ms 384 KB Output is correct
33 Correct 13 ms 364 KB Output is correct
34 Correct 15 ms 324 KB Output is correct
35 Correct 40 ms 384 KB Output is correct
36 Execution timed out 1056 ms 59920 KB Time limit exceeded
37 Halted 0 ms 0 KB -