제출 #463633

#제출 시각아이디문제언어결과실행 시간메모리
463633EliasT-Covering (eJOI19_covering)C++17
0 / 100
2 ms588 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...