답안 #623135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623135 2022-08-05T08:48:37 Z CSQ31 Escape Route (JOI21_escape_route) C++17
컴파일 오류
0 ms 0 KB
#include "escape_route.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000;
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll,ll> pii;
ll L[MAXN],C[MAXN];
vector<pii>adj[MAXN];	
					   
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n,m,q;
  ll s;
  cin>>n>>m>>s>>q;
  for(int i=0;i<m;i++){
	  int a,b;
	  cin>>a>>b>>L[i]>>C[i];
	  adj[a].push_back({b,i});
	  adj[b].push_back({a,i});
  }
  for(int i=0;i<q;i++){
	  vector<ll>dist(n,1e18);
	  int U,V;
	  ll T;
	  cin>>U>>V>>T;
	  priority_queue<pii,vector<pii>,greater<pii>>pq;
	  pq.push({T,U});
	  dist[U] = T;
	  while(!pq.empty()){
		  pii v = pq.top();
		  pq.pop();
		  int f = v.se;
		  ll mod = v.fi%s;
		  if(v.fi != dist[f])continue;
		  for(pii x:adj[v.se]){
			  int to = x.fi;
			  //mod+L[x.se] <= C[x.se]
			  if(mod+L[x.se] <= C[x.se]){
				  if(dist[to] > dist[f] + L[x.se]){
					  dist[to] = dist[f] + L[x.se];
					  pq.push({dist[to],to});
				  }
			  }else{
				  if(dist[to] > dist[f] + s-mod + L[x.se]){
					  dist[to] = dist[f] + s-mod + L[x.se];
					  pq.push({dist[to],to});
				  }
			  }
		  }
	  }
	 // for(int i=0;i<n;i++)cout<<dist[i]<<" ";
	 // cout<<'\n';
	  cout<<dist[V]-T<<'\n';
  }	
	
	
	
}

Compilation message

/usr/bin/ld: /tmp/ccv4qPGu.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccxgT7nx.o:escape_route.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccv4qPGu.o: in function `main':
grader.cpp:(.text.startup+0x6ea): undefined reference to `calculate_necessary_time(int, int, long long, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<long long, std::allocator<long long> >, std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status