Submission #463633

# Submission time Handle Problem Language Result Execution time Memory
463633 2021-08-11T12:06:00 Z Elias T-Covering (eJOI19_covering) C++17
0 / 100
2 ms 588 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int n, m, k;

struct Tetro
{
	int x, y;
};

vector<vector<int>> grid;
vector<Tetro> tetros;

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

	cin >> m >> n;

	grid = vector<vector<int>>(n, vector<int>(m));

	for (int y = 0; y < m; y++)
		for (int x = 0; x < n; x++)
			cin >> grid[x][y];

	cin >> k;

	tetros = vector<Tetro>(k);

	for (int i = 0; i < k; i++)
	{
		int x, y;
		cin >> y >> x;
		tetros[i] = {x, y};
		// make sure it is possible to place the current tetro
		if ((x == 0 || x == n - 1) && (y == 0 || y == m - 1))
		{
			cout << "No";
			return 0;
		}
	}

	int solution = 0;

	for (Tetro t : tetros)
	{
		int a = grid[t.x + 1][t.y + 0];
		int b = grid[t.x - 1][t.y + 0];
		int c = grid[t.x + 0][t.y + 1];
		int d = grid[t.x + 0][t.y - 1];
		solution += a + b + c + d - min(a, min(b, min(c, d)));
	}
	cout << solution;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 588 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -