답안 #71935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71935 2018-08-26T01:31:47 Z KLPP 철인 이종 경기 (APIO18_duathlon) C++14
0 / 100
1000 ms 11104 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=i+1;j<n;j++){
			ans+=dist[j]-1;
		}
	}
	ans*=2;
	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++){
                ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 7932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 7932 KB Output is correct
2 Correct 22 ms 7932 KB Output is correct
3 Correct 22 ms 7932 KB Output is correct
4 Correct 26 ms 7932 KB Output is correct
5 Correct 36 ms 7932 KB Output is correct
6 Correct 28 ms 7932 KB Output is correct
7 Correct 30 ms 7932 KB Output is correct
8 Correct 25 ms 7932 KB Output is correct
9 Correct 28 ms 7932 KB Output is correct
10 Incorrect 20 ms 7932 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 9744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 9744 KB Output is correct
2 Correct 27 ms 9744 KB Output is correct
3 Incorrect 29 ms 9744 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 11104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -