Submission #2547569
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { int width; int height; int row; int col; string board[50]; cin >> height >> width; for (row = 0; row < height; row++) { cin >> board[row]; } int dx[8] = {-1,-1,-1,0,0,1,1,1}; int dy[8] = {-1,0,1,-1,1,-1,0,1}; for(row = 0; row < height; row++) { for(col = 0; col < width; col++) { if (board[row][col] == '#') { continue; } int num = 0; for(int index = 0; index < 8; index++) { int nx = col + dx[index]; int ny = row + dy[index]; if (nx < 0 || nx > width) { continue; } if (ny < 0 || ny > height) { continue; } if (board[ny][nx] == '#') { num++; } } board[row][col] = char(num + '0'); } } for (row = 0; row < height; row++) { cout << board[row] << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Minesweeper |
User | jin3 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1020 Byte |
Status | RE |
Exec Time | 98 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_1.txt | RE | 98 ms | 256 KB |
subtask_1_10.txt | RE | 97 ms | 256 KB |
subtask_1_11.txt | AC | 1 ms | 256 KB |
subtask_1_12.txt | AC | 1 ms | 256 KB |
subtask_1_2.txt | AC | 1 ms | 256 KB |
subtask_1_3.txt | AC | 1 ms | 256 KB |
subtask_1_4.txt | AC | 1 ms | 256 KB |
subtask_1_5.txt | AC | 1 ms | 256 KB |
subtask_1_6.txt | AC | 1 ms | 256 KB |
subtask_1_7.txt | AC | 1 ms | 256 KB |
subtask_1_8.txt | AC | 1 ms | 256 KB |
subtask_1_9.txt | AC | 1 ms | 256 KB |