Submission #104348

# Submission time Handle Problem Language Result Execution time Memory
104348 2019-04-05T14:00:02 Z tc_abd Duathlon (APIO18_duathlon) C++14
10 / 100
25 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
int n,m,ans;
bool done[1009];
vector < int > v[1009];
void dfs(int node,int w){
    if(w != 0) ans += w-1;
    done[node] = 1;
    for(int i=0;i<v[node].size();i++){
        int u = v[node][i];
        if(!done[u]) dfs(u,w+1);
    }
}
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=0;i<n;i++){
        memset(done,0,sizeof(done));
        dfs(i,0);
    }
    cout<<ans<<endl;
}

Compilation message

count_triplets.cpp: In function 'void dfs(int, int)':
count_triplets.cpp:9:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[node].size();i++){
                 ~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 384 KB Output is correct
2 Correct 16 ms 412 KB Output is correct
3 Correct 14 ms 384 KB Output is correct
4 Correct 20 ms 384 KB Output is correct
5 Correct 22 ms 428 KB Output is correct
6 Correct 21 ms 384 KB Output is correct
7 Correct 23 ms 384 KB Output is correct
8 Correct 19 ms 384 KB Output is correct
9 Correct 25 ms 384 KB Output is correct
10 Correct 13 ms 384 KB Output is correct
11 Correct 12 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 7 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 9 ms 384 KB Output is correct
18 Correct 11 ms 384 KB Output is correct
19 Correct 8 ms 384 KB Output is correct
20 Correct 16 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 512 KB Output is correct
2 Correct 18 ms 384 KB Output is correct
3 Incorrect 16 ms 424 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -