Submission #361728

# Submission time Handle Problem Language Result Execution time Memory
361728 2021-01-31T12:13:39 Z David_M Dreaming (IOI13_dreaming) C++14
Compilation error
0 ms 0 KB
#include "dreaming.h"
#include<bits/stdc++.h>
using namespace std;
int d[3][1<<17],f[1<<17],W[1<<17],w,e,D,F,S;
vector<pair<int,int> >v[1<<17];
void dfs(int x,int o){
	f[x]++;
	if(o<2&&d[o][x]>=D)e=x,D=d[o][x];
	if(o>1)D=min(D,max(d[1][x],d[2][x]));
	for(auto y:v[x])if(f[y.first]<=o)d[o][y.first]=d[o][x]+y.second,dfs(y.first,o);
}
int travelTime(int N,int M,int L,int A[],int B[],int T[]){
    while(M--)v[A[M]].push_back({B[M],T[M]}),v[B[M]].push_back({A[M],T[M]});
    while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),W[w++]=-D,D=0;
    sort(W,W+w);
	return max(-W[0], (w>2)*(-W[2]+L))-(w>1) *(W[1]-L);
}
main(){
	int NN, MM, LL, AA[100001], BB[100001], TT[100001];
	cin>>NN>>MM>>LL;
	for (int i=0; i<MM; i++)cin>>AA[i]>>BB[i]>>TT[i];
	cout<<travelTime(NN,MM,LL,AA,BB,TT)<<'\n';
	for (int i=0; i<NN; i++){
	    cout<<d[0][i]<<" "<<d[1][i]<<" "<<d[2][i]<<" "<<W[i]<<endl;
	}
}

Compilation message

dreaming.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main(){
      |      ^
/tmp/ccVczsmG.o: In function `main':
dreaming.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccCxeL4l.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status