제출 #448797

#제출 시각아이디문제언어결과실행 시간메모리
448797UltraFalconT-Covering (eJOI19_covering)C++17
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int m, n; cin >> m >> n; vector<vector<int>> grid(m+2, vector<int>(n+2, 0)); for (int y=0; y<m; y++) { for (int x=0; x<n; x++) { cin >> grid[y+1][x+1]; } } int k; cin >> k; vector<vector<bool>> sp_grid(m+2, vector<bool>(n+2, false)); vector<pair<int, int>> sp_cells(k); for (int i=0; i<n; i++) { int ri, ci; cin >> ri >> ci; sp_grid[ri+1][ci+1] = true; sp_cells.emplace_back(ri, ci); } int sum = 0; for (auto [ri, ci] : sp_cells) { sum += grid[ri+1][ci] + grid[ri+1][ci+2] + grid[ri][ci+1] + grid[ri+2][ci+1] - \ min(min(grid[ri+1][ci], grid[ri+1][ci+2]), min(grid[ri][ci+1], grid[ri+2][ci+1])); } }
#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...