Submission #1359111

#TimeUsernameProblemLanguageResultExecution timeMemory
1359111mahmudisaliMinesweeper (COCI25_minesweeper)C++20
50 / 50
14 ms1904 KiB
// Mahmud Isali
#pragma GCC optimize("O3")

#include <bits/stdc++.h>
// #include <bits/extc++.h>

using namespace std;
// using namespace __gnu_pbds;

// #define int long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const long long INF = 1e18, MOD = 1e9 + 9, N =  5e5 + 10;
void solve() {
    int n,m,k;
    cin >> n >> m >> k;
    vector<vector<int>> v(n + 2, vector<int>(m + 2, 0));
    for(int i = 1; i <= k; i++) {
        int x,y;
        cin >> x >> y;
        v[x][y] = -1;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(v[i][j] == -1) {
                cout << "B ";
                continue; 
            }
            int cnt = 0;
            for(int x = -1; x <= 1; x++) {
                for(int y = -1; y <= 1; y++) {
                    if(v[i + x][j + y] == -1)   cnt++;
                }
            }
            cout << cnt << ' ';
        }
        cout << endl;
    }
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for(int T = 1; T <= t; T++) {
        solve();
    }
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...