Submission #707585

# Submission time Handle Problem Language Result Execution time Memory
707585 2023-03-09T11:52:55 Z Trisanu_Das Autobus (COCI22_autobus) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
const int INF=1e9;
int n, m, k, q, adj[70][70], dp[70][70][70];
 
int main(){
  cin >> n >> m;
  memset(adj, INT_MAX, sizeof(adj));
  for(int i = 0; i < n; i++) adj[i][i] = 0;
  while(m--){
    int u, v, w; cin >> u >> v >> w;
    adj[u - 1][v - 1] = min(adj[u - 1][v - 1], w);
  }
  cin >> k >> q;
  k = (k > n - 1) ? n - 1 : k;
  memset(dp, 0x3f, sizeof(dp);
  for (int i=0; i<n; ++i)
		for (int j=0; j<n; ++j) {
			dp[0][i][j]=i==j?0:INF;
			dp[1][i][j] = adj[i][j];
		}
  for(int i = 2; i < k + 1; i++) for(int u = 0; u < n; u++) for(int u2 = 0; u2 < n; u2++) for(int v = 0; v < n; v++) dp[i][u][v] = min(dp[i][u][v], dp[i - 1][u][u2] + adj[u2][v]);
  while(q--) {
		int a, b;
		cin >> a >> b, --a, --b;
		cout << (dp[k][a][b]>=INF?-1:dp[k][a][b]) << "\n";
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:17:30: error: expected ')' before ';' token
   17 |   memset(dp, 0x3f, sizeof(dp);
      |         ~                    ^
      |                              )