Submission #8841200
Source Code Expand
#include <vector> #include <math.h> #include <iostream> #include <string> #include <algorithm> #include <queue> #include <iomanip> #include <deque> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; #define rep(i, n) for(int i = 0; i<n; i++) #define rep_s(i, start, n) for(int i= start; i<n; i++) #define ALL(a) (a).begin(), (a).end() string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string alphabet_lower = "abcdefghijklmnopqrstuvwxyz"; /* using edge = struct {int to; ll cost;}; vector<edge> tree[limit]; ll depth[limit]; void dfs(int v, int p, ll d){ depth[v] = d; //cout <<"v: " << v << endl; for (auto &e: tree[v]){ //cout << "e.to: " << e.to << endl; if (e.to == p) continue; dfs(e.to, v, d+e.cost); } } */ int main(void){ int H, W; cin >> H >> W; string s[H+2]; string s_input; s[0] = string(W+2, 'a'); s[H+1] =string(W+2, 'a'); rep_s(i, 1, H+1) { cin >> s_input; s[i] = 'a' + s_input +'a'; } string s_up, s_low, s_now; int count; //cout <<"hello" << endl; rep_s(i, 1, H+1){ //cout <<"i: " << i << endl; s_up = s[i-1]; s_low = s[i+1]; s_now = s[i]; //cout <<"s_up" << endl; rep_s(j,1, W+1){ if (s_now[j] == '#') cout <<"#"; else { count = 0; rep(k, 3){ if (s_up[j+k-1] =='#') count++; if (s_low[j+k-1] =='#') count++; } if (s_now[j-1] == '#') count++; if (s_now[j+1] == '#') count++; cout << count; } } cout << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Minesweeper |
User | Daisi96 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1716 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 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 | AC | 2 ms | 256 KB |
subtask_1_10.txt | AC | 2 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 |