Submission #547563

#TimeUsernameProblemLanguageResultExecution timeMemory
547563tmn2005Commuter Pass (JOI18_commuter_pass)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long

const int N = 1e5 + 12
int n, m, s, f, l, r, x, y, z, res, dis[505][505];

signed main(){
	ios::sync_with_stdio(0), cin.tie(0);
	memset(dis, 63, sizeof dis);
	for(int i=1; i<=n; i++)dis[i][i] = 0;
	
	cin>>n>>m;
	cin>>s>>f;
	cin>>l>>r;
	while(m--){
		cin>>x>>y>>z;
		dis[x][y] = min(dis[x][y], z);
		dis[y][x] = min(dis[y][x], z);
	}
	for(int k=1; k<=n; k++){
		for(int i=1; i<=n; i++){
			for(int j=1; j<=n; j++){
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	res = dis[l][r];
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			if(dis[s][i] + dis[i][j] + dis[j][f] == dis[s][f]){
				res = min(res, dis[l][i] + dis[j][r]);
				res = min(res, dis[l][j] + dis[i][r]);
			}
		}	
	}
	cout<<res<<"\n";
}

Compilation message (stderr)

commuter_pass.cpp:4:13: error: expected ',' or ';' before 'long'
    4 | #define int long long
      |             ^~~~
commuter_pass.cpp:7:1: note: in expansion of macro 'int'
    7 | int n, m, s, f, l, r, x, y, z, res, dis[505][505];
      | ^~~
commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:11:9: error: 'dis' was not declared in this scope; did you mean 'div'?
   11 |  memset(dis, 63, sizeof dis);
      |         ^~~
      |         div
commuter_pass.cpp:12:18: error: 'n' was not declared in this scope
   12 |  for(int i=1; i<=n; i++)dis[i][i] = 0;
      |                  ^
commuter_pass.cpp:14:7: error: 'n' was not declared in this scope
   14 |  cin>>n>>m;
      |       ^
commuter_pass.cpp:14:10: error: 'm' was not declared in this scope
   14 |  cin>>n>>m;
      |          ^
commuter_pass.cpp:15:7: error: 's' was not declared in this scope
   15 |  cin>>s>>f;
      |       ^
commuter_pass.cpp:15:10: error: 'f' was not declared in this scope
   15 |  cin>>s>>f;
      |          ^
commuter_pass.cpp:16:7: error: 'l' was not declared in this scope
   16 |  cin>>l>>r;
      |       ^
commuter_pass.cpp:16:10: error: 'r' was not declared in this scope
   16 |  cin>>l>>r;
      |          ^
commuter_pass.cpp:18:8: error: 'x' was not declared in this scope
   18 |   cin>>x>>y>>z;
      |        ^
commuter_pass.cpp:18:11: error: 'y' was not declared in this scope
   18 |   cin>>x>>y>>z;
      |           ^
commuter_pass.cpp:18:14: error: 'z' was not declared in this scope
   18 |   cin>>x>>y>>z;
      |              ^
commuter_pass.cpp:29:2: error: 'res' was not declared in this scope
   29 |  res = dis[l][r];
      |  ^~~