Submission #206615

# Submission time Handle Problem Language Result Execution time Memory
206615 2020-03-04T08:50:00 Z opukittpceno_hhr Soccer (JOI17_soccer) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

#define int long long

const int INF = 1e18 + 239;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int h, w, a, b, c, n;
	cin >> h >> w >> a >> b >> c >> n;
	h++;
	w++;
	vector<int> s(n);
	vector<int> t(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i] >> t[i];
	}
	auto cost = [&](int i, int j) {
		if (i == j) return 0;
		//move i
		int ans = INF;
		for (int tj = 0; tj < w; tj++) {
			int mi = s[j];
			int mj = tj;
			int cur = c * (abs(s[i] - mi) + abs(t[i] - mj)) + b + a * (abs(mi - s[j]));
			if (mi == s[j] && mj == t[j]) cur -= b;

			ans = min(ans, cur);
		}
		for (int ti = 0; ti < h; ti++) {
			int mi = ti;
			int mj = t[j];
			int cur = c * (abs(s[i] - mi) + abs(t[i] - mj)) + b + a * (abs(mj - t[j]));
			if (mi == s[j] && mj == t[j]) cur -= b;
			ans = min(ans, cur);
		}
		return ans;
	};
	vector<vector<int>> d(n, vector<int> (n, INF));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			d[i][j] = cost(i, j);
		}
	}

	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	cout << d[0][n - 1] << endl;
}

Compilation message

soccer.cpp: In lambda function:
soccer.cpp:60:10: error: inconsistent types 'int' and 'long long int' deduced for lambda return type
   return ans;
          ^~~