Submission #117587

# Submission time Handle Problem Language Result Execution time Memory
117587 2019-06-16T17:51:37 Z KieranHorgan Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
#define endl '\n'
#define ll long long
#define ld double
#define pii pair<int,int>
#define rand() abs((rand()<<15)|rand())
#define randll() abs(((long long)rand()<<30)|rand())

vector<pair<int,int>> AdjList[1000005];
int dist1[100005];
int dist2[100005];

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long seed;
	asm("rdtsc" : "=A"(seed));
	srand(seed);

	int n, m, k;
	cin >> n >> m >> k;
	for(int i = 0; i < m; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		AdjList[u].push_back({w,v});
		AdjList[v].push_back({w,u});
	}
	vector<int> destination(k);
	for(auto &x: destination)
		cin >> x;


	memset(dist1, 63, sizeof(dist1));
	memset(dist2, 63, sizeof(dist2));
	priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
	for(auto x: destination) {
		pq.push({0,x});
		dist1[x]=0;
		dist2[x]=0;
	}
	while(!pq.empty()) {
		int u = pq.top().second;
		int w = pq.top().first; pq.pop();
		if(w > dist2[u]) continue;
		// cerr << u << ": " << dist2[u] << endl;
		for(auto v: AdjList[u])
			if(dist2[u]+v.first < dist1[v.second]) {
				// cerr << " " << u << "->" << v.second << endl;
				dist2[v.second] = dist1[v.second];
				dist1[v.second] = dist2[u] + v.first;
				if(dist2[v.second])
					pq.push({dist2[v.second], v.second});
			} else if(dist2[u]+v.first < dist2[v.second]) {
				// cerr << "  " << u << "->" << v.second << endl;
				dist2[v.second] = dist2[u] + v.first;
				pq.push({dist2[v.second], v.second});
			}
	}

	cout << dist2[0] << endl;
}

Compilation message

crocodile.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
 
/tmp/ccZTgizA.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccGPejVd.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/ccZTgizA.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status