답안 #742805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742805 2023-05-17T01:45:51 Z riodsa Collecting Mushrooms (NOI18_collectmushrooms) C++17
60 / 100
25 ms 9396 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<ll,ll>
ll r,c,d,w;
const int N = 5e2+1;
char b[N][N];
ll qs[N][N];
vector<pii> mush;

int main()
{
    cin >> r >> c >> d >> w;
    for(int i=1;i<=r;++i)
    {
        for(int j=1;j<=c;++j)
        {
            cin >> b[i][j];
            if(b[i][j] == 'S') qs[i][j] = 1;
            if(b[i][j] == 'M') mush.push_back({i,j});
        }
    }
    for(int i=1;i<=r;++i)
    {
        for(int j=1;j<=c;++j)
        {
            qs[i][j] += qs[i-1][j]+qs[i][j-1]-qs[i-1][j-1];
        }
    }
    ll cnt = 0;
    for(pii xy : mush)
    {
        ll x,y;
        tie(x,y) = xy;
        ll mx = min(r,x+d),mnx = max((ll)1,x-d);
        ll my = min(c,y+d),mny = max((ll)1,y-d);
        ll spring = qs[mx][my]-qs[mx][mny-1]-qs[mnx-1][my]+qs[mnx-1][mny-1];
        if(spring >= w) ++cnt;
    }
    cout << cnt;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 2 ms 852 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 2 ms 852 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 692 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 724 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2364 KB Output is correct
2 Correct 14 ms 2572 KB Output is correct
3 Correct 16 ms 2688 KB Output is correct
4 Correct 13 ms 2288 KB Output is correct
5 Correct 13 ms 2572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 25 ms 9396 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 852 KB Output is correct
3 Correct 2 ms 852 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 692 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 724 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 1 ms 980 KB Output is correct
16 Correct 12 ms 2364 KB Output is correct
17 Correct 14 ms 2572 KB Output is correct
18 Correct 16 ms 2688 KB Output is correct
19 Correct 13 ms 2288 KB Output is correct
20 Correct 13 ms 2572 KB Output is correct
21 Runtime error 25 ms 9396 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -