Submission #361715

# Submission time Handle Problem Language Result Execution time Memory
361715 2021-01-31T11:16:51 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],e,D,F,S,i;
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]=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[i]].pb({B[i],T[i]}),v[B[i]].pb({A[i],T[i]});
    while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),F=min(D,F),S=max(D,S),D=0;
	return F+S+L;
}

Compilation message

dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:13:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   13 |     while(M--)v[A[i]].pb({B[i],T[i]}),v[B[i]].pb({A[i],T[i]});
      |                       ^~
dreaming.cpp:13:47: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   13 |     while(M--)v[A[i]].pb({B[i],T[i]}),v[B[i]].pb({A[i],T[i]});
      |                                               ^~