| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 218150 | Vimmer | Emacs (COCI20_emacs) | C++14 | 6 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 200005
#define M ll(1000000007)
using namespace std;
typedef long long ll;
int step[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}, x, y, n, m;
bool mk[200][200];
string a[200];
bool gd()
{
for (x = 0; x < n; x++)
for (y = 0; y < m; y++)
if (a[x][y] == '*' && !mk[x][y]) {mk[x][y] = 1; return 1;}
return 0;
}
queue <pair <int, int> > qr;
int main()
{
//freopen("mining.in","r",stdin); freopen("mining.out","w",stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
int ans = 0;
while (gd())
{
qr.push({x, y});
ans++;
while (sz(qr) > 0)
{
int x = qr.front().F;
int y = qr.front().S;
qr.pop();
for (int i = 0; i < 4; i++)
{
int cx = x + step[i][0];
int cy = y + step[i][1];
if (cx >= 0 && cx < n && cy >= 0 && cy < m && !mk[cx][cy] && a[cx][cy] == '*')
{
mk[cx][cy] = 1;
qr.push({cx, cy});
}
}
}
}
cout << ans << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
