Submission #980823

# Submission time Handle Problem Language Result Execution time Memory
980823 2024-05-12T13:13:29 Z Unforgettablepl Duathlon (APIO18_duathlon) C++17
5 / 100
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

int adj[11][11];
bool ans[11][11][11];

void calc(const vector<int>& path){
    if(path.size()<3)return;
    for(int i=1;i<path.size();i++){
        if(!adj[path[i]][path[i-1]])return;
        for(int k=1;k<i;k++)ans[path[0]][path[k]][path[i]]=true;
    }
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        adj[a][b]=adj[b][a]=true;
    }
    vector<int> path(n);iota(path.begin(), path.end(),1);
    do {
        calc(path);
    } while(next_permutation(path.begin(), path.end()));
    int curr = 0;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)for(int k=1;k<=n;k++)if(ans[i][j][k])curr++;
    cout << curr << '\n';
}

Compilation message

count_triplets.cpp: In function 'void calc(const std::vector<long long int>&)':
count_triplets.cpp:11:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=1;i<path.size();i++){
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 20 ms 348 KB Output is correct
7 Correct 31 ms 348 KB Output is correct
8 Correct 25 ms 352 KB Output is correct
9 Correct 52 ms 348 KB Output is correct
10 Correct 183 ms 348 KB Output is correct
11 Correct 22 ms 344 KB Output is correct
12 Correct 23 ms 348 KB Output is correct
13 Correct 31 ms 460 KB Output is correct
14 Correct 22 ms 348 KB Output is correct
15 Correct 22 ms 460 KB Output is correct
16 Correct 23 ms 460 KB Output is correct
17 Correct 23 ms 348 KB Output is correct
18 Correct 23 ms 348 KB Output is correct
19 Correct 31 ms 460 KB Output is correct
20 Correct 20 ms 456 KB Output is correct
21 Correct 22 ms 348 KB Output is correct
22 Correct 22 ms 440 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 348 KB Output is correct
26 Correct 22 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 3 ms 348 KB Output is correct
29 Correct 24 ms 348 KB Output is correct
30 Correct 1 ms 456 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 33 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 20 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 20 ms 348 KB Output is correct
7 Correct 31 ms 348 KB Output is correct
8 Correct 25 ms 352 KB Output is correct
9 Correct 52 ms 348 KB Output is correct
10 Correct 183 ms 348 KB Output is correct
11 Correct 22 ms 344 KB Output is correct
12 Correct 23 ms 348 KB Output is correct
13 Correct 31 ms 460 KB Output is correct
14 Correct 22 ms 348 KB Output is correct
15 Correct 22 ms 460 KB Output is correct
16 Correct 23 ms 460 KB Output is correct
17 Correct 23 ms 348 KB Output is correct
18 Correct 23 ms 348 KB Output is correct
19 Correct 31 ms 460 KB Output is correct
20 Correct 20 ms 456 KB Output is correct
21 Correct 22 ms 348 KB Output is correct
22 Correct 22 ms 440 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 348 KB Output is correct
26 Correct 22 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 3 ms 348 KB Output is correct
29 Correct 24 ms 348 KB Output is correct
30 Correct 1 ms 456 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 33 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 20 ms 468 KB Output is correct
36 Execution timed out 1053 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 20 ms 348 KB Output is correct
7 Correct 31 ms 348 KB Output is correct
8 Correct 25 ms 352 KB Output is correct
9 Correct 52 ms 348 KB Output is correct
10 Correct 183 ms 348 KB Output is correct
11 Correct 22 ms 344 KB Output is correct
12 Correct 23 ms 348 KB Output is correct
13 Correct 31 ms 460 KB Output is correct
14 Correct 22 ms 348 KB Output is correct
15 Correct 22 ms 460 KB Output is correct
16 Correct 23 ms 460 KB Output is correct
17 Correct 23 ms 348 KB Output is correct
18 Correct 23 ms 348 KB Output is correct
19 Correct 31 ms 460 KB Output is correct
20 Correct 20 ms 456 KB Output is correct
21 Correct 22 ms 348 KB Output is correct
22 Correct 22 ms 440 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 348 KB Output is correct
26 Correct 22 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 3 ms 348 KB Output is correct
29 Correct 24 ms 348 KB Output is correct
30 Correct 1 ms 456 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 33 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 20 ms 468 KB Output is correct
36 Execution timed out 1053 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 20 ms 348 KB Output is correct
7 Correct 31 ms 348 KB Output is correct
8 Correct 25 ms 352 KB Output is correct
9 Correct 52 ms 348 KB Output is correct
10 Correct 183 ms 348 KB Output is correct
11 Correct 22 ms 344 KB Output is correct
12 Correct 23 ms 348 KB Output is correct
13 Correct 31 ms 460 KB Output is correct
14 Correct 22 ms 348 KB Output is correct
15 Correct 22 ms 460 KB Output is correct
16 Correct 23 ms 460 KB Output is correct
17 Correct 23 ms 348 KB Output is correct
18 Correct 23 ms 348 KB Output is correct
19 Correct 31 ms 460 KB Output is correct
20 Correct 20 ms 456 KB Output is correct
21 Correct 22 ms 348 KB Output is correct
22 Correct 22 ms 440 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 348 KB Output is correct
26 Correct 22 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 3 ms 348 KB Output is correct
29 Correct 24 ms 348 KB Output is correct
30 Correct 1 ms 456 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 33 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 20 ms 468 KB Output is correct
36 Execution timed out 1053 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -