Submission #742680

# Submission time Handle Problem Language Result Execution time Memory
742680 2023-05-16T17:04:56 Z riodsa Collecting Mushrooms (NOI18_collectmushrooms) C++17
9 / 100
22 ms 5652 KB
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
int r,c,d,w;
const int N = 5e2+1;
char b[N][N];
int 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];
        }
    }
    int cnt = 0;
    for(auto [x,y] : mush)
    {
        int mx = min(r,x+d),mnx = max(1,x-d);
        int my = min(c,y+d),mny = max(1,y-d);
        int spring = qs[mx][my]-qs[mnx][my-1]-qs[mnx-1][my]+qs[mnx-1][mny-1];
        if(spring >= w) ++cnt;
    }
    cout << cnt;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 0 ms 468 KB Output is correct
7 Incorrect 1 ms 340 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 5652 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 0 ms 468 KB Output is correct
7 Incorrect 1 ms 340 KB Output isn't correct
8 Halted 0 ms 0 KB -