Submission #49369

# Submission time Handle Problem Language Result Execution time Memory
49369 2018-05-28T02:29:36 Z mirbek01 Duathlon (APIO18_duathlon) C++17
0 / 100
1000 ms 204756 KB
# include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 2;

int n, m, used[N];
vector <int> g[N], vec;
map < pair <int, pair <int, int> > , int> ans;

void dfs(int v, int pr = 0){
      used[v] = 1;
      vec.push_back(v);
      for(int i = 1; i < vec.size() - 1; i ++){
            ans[{vec[0], {vec[i], vec.back()}}] = 1;
      }
      for(int to : g[v]){
            if(to == pr || used[to]) continue;
            dfs(to, v);
      }
      vec.pop_back();
      used[v] = 0;
}

int main(){
      cin >> n >> m;

      for(int i = 1; i <= m; i ++){
            int u, v;
            cin >> u >> v;
            g[u].push_back(v);
            g[v].push_back(u);
      }

      for(int i = 1; i <= n; i ++)
            dfs(i);

      cout << ans.size() << endl;
}

Compilation message

count_triplets.cpp: In function 'void dfs(int, int)':
count_triplets.cpp:14:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i = 1; i < vec.size() - 1; i ++){
                      ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2752 KB Output is correct
4 Correct 5 ms 2804 KB Output is correct
5 Correct 5 ms 2804 KB Output is correct
6 Correct 4 ms 2804 KB Output is correct
7 Correct 5 ms 2848 KB Output is correct
8 Correct 7 ms 2848 KB Output is correct
9 Correct 106 ms 2916 KB Output is correct
10 Execution timed out 1086 ms 2976 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2752 KB Output is correct
4 Correct 5 ms 2804 KB Output is correct
5 Correct 5 ms 2804 KB Output is correct
6 Correct 4 ms 2804 KB Output is correct
7 Correct 5 ms 2848 KB Output is correct
8 Correct 7 ms 2848 KB Output is correct
9 Correct 106 ms 2916 KB Output is correct
10 Execution timed out 1086 ms 2976 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 86212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 188560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 188560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 204756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 204756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2752 KB Output is correct
4 Correct 5 ms 2804 KB Output is correct
5 Correct 5 ms 2804 KB Output is correct
6 Correct 4 ms 2804 KB Output is correct
7 Correct 5 ms 2848 KB Output is correct
8 Correct 7 ms 2848 KB Output is correct
9 Correct 106 ms 2916 KB Output is correct
10 Execution timed out 1086 ms 2976 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2752 KB Output is correct
4 Correct 5 ms 2804 KB Output is correct
5 Correct 5 ms 2804 KB Output is correct
6 Correct 4 ms 2804 KB Output is correct
7 Correct 5 ms 2848 KB Output is correct
8 Correct 7 ms 2848 KB Output is correct
9 Correct 106 ms 2916 KB Output is correct
10 Execution timed out 1086 ms 2976 KB Time limit exceeded
11 Halted 0 ms 0 KB -