Submission #71936

# Submission time Handle Problem Language Result Execution time Memory
71936 2018-08-26T01:36:06 Z KLPP Duathlon (APIO18_duathlon) C++14
10 / 100
1000 ms 7416 KB
#include<iostream>
#include<stdio.h>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;
typedef long long int lld;

int main(){
	int n,m;
	cin>>n>>m;
	vector<int>nei[n];
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		x--;y--;
		nei[x].push_back(y);
		nei[y].push_back(x);
	}
	lld ans=0;
	for(int i=0;i<n;i++){
		lld dist[n];
		for(int j=0;j<n;j++)dist[j]=-1;
		dist[i]=0;
		queue<int>q;
		q.push(i);
		while(!q.empty()){
			int u=q.front();q.pop();
			for(int j=0;j<nei[u].size();j++){
				int v=nei[u][j];
				if(dist[v]==-1){
					dist[v]=dist[u]+1;
					q.push(v);
				}
			}
		}
		//for(int j=0;j<n;j++)cout<<dist[j]<<" ";
		//cout<<endl;
		for(int j=0;j<n;j++){
			if(dist[j]>0)ans+=dist[j]-1;
		}
	}
	cout<<ans<<endl;

	return 0;	
}

Compilation message

count_triplets.cpp: In function 'int main()':
count_triplets.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=0;j<nei[u].size();j++){
                ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 6708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 6708 KB Output is correct
2 Correct 26 ms 6708 KB Output is correct
3 Correct 26 ms 6708 KB Output is correct
4 Correct 22 ms 6708 KB Output is correct
5 Correct 26 ms 6708 KB Output is correct
6 Correct 26 ms 6708 KB Output is correct
7 Correct 23 ms 6708 KB Output is correct
8 Correct 27 ms 6708 KB Output is correct
9 Correct 28 ms 6708 KB Output is correct
10 Correct 18 ms 6708 KB Output is correct
11 Correct 22 ms 6708 KB Output is correct
12 Correct 17 ms 6708 KB Output is correct
13 Correct 10 ms 6708 KB Output is correct
14 Correct 7 ms 6708 KB Output is correct
15 Correct 6 ms 6708 KB Output is correct
16 Correct 6 ms 6708 KB Output is correct
17 Correct 13 ms 6708 KB Output is correct
18 Correct 14 ms 6708 KB Output is correct
19 Correct 16 ms 6708 KB Output is correct
20 Correct 16 ms 6708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 7416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 7416 KB Output is correct
2 Correct 23 ms 7416 KB Output is correct
3 Incorrect 27 ms 7416 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 7416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -