# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
263819 | T0p_ | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 45 ms | 16752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
vector<pair<int, int>> mushroom;
int main()
{
int n, m, d, w;
scanf(" %d %d %d %d",&n,&m,&d,&w);
int qs[n+5][m+5];
memset(qs, 0, sizeof qs);
for(int i=1 ; i<=n ; i++)
for(int j=1 ; j<=m ; j++)
{
char c;
scanf(" %c",&c);
if(c == 'M') mushroom.push_back({i, j});
else if(c == 'S')
{
int si = max(1, i-d), sj = max(1, j-d), ei = min(n, i+d), ej = min(m, j+d);
qs[si][sj]++;
qs[si][ej+1]--;
qs[ei+1][sj]--;
qs[ei+1][ej+1]++;
}
}
for(int i=1 ; i<=n ; i++)
for(int j=1 ; j<=m ; j++)
qs[i][j] += qs[i-1][j] + qs[i][j-1] - qs[i-1][j-1];
int ans = 0;
for(auto x : mushroom)
if(qs[x.first][x.second] >= w) ans++;
printf("%d\n",ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |