Submission #933092

# Submission time Handle Problem Language Result Execution time Memory
933092 2024-02-25T02:34:01 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++14
100 / 100
21 ms 31796 KB
#include <bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fi first
#define se second
#define pb push_back
#define task "hetcuu"
using namespace std;
using ll = long long;
using ld = long double;
const int maxN = 5e5 + 10;
int r,c,d,k;
vector <int> a[maxN];
vector <int> b[maxN];
void update(int i,int j ,int x){
    if(i > r || j > c) return ;
    i = max(i,1);
    j = max(j,1);
    a[i][j] += x;
}
void init(){
    cin >> r >> c >> d >> k;
    for(int i = 0;i <= r;++i){
        a[i].resize(c + 1);
        b[i].resize(c + 1);
    }
    for(int i = 1;i <= r;++i){
        for(int j = 1;j <= c;++j){
            char tem; cin >> tem;
            if(tem == '.') continue;
            else if(tem == 'M'){
                b[i][j] = 1;
            }
            else{
                update(i - d,j -d,1);
                update(i + d + 1,j - d,-1);
                update(i - d,j + d + 1,-1);
                update(i + d + 1,j + d + 1,1);
            }
        }
    }
    int ans = 0;
    for(int i = 1;i <= r;++i){
        for(int j = 1;j <= c;++j){
            a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
            if(b[i][j] == 1){
                if(a[i][j] >= k){
                    ans++;
                }
            }
        }
    }
    cout << ans;
}
int main(){
    faster
    init();
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 23896 KB Output is correct
2 Correct 6 ms 23896 KB Output is correct
3 Correct 6 ms 23900 KB Output is correct
4 Correct 6 ms 23900 KB Output is correct
5 Correct 6 ms 23900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 23896 KB Output is correct
2 Correct 6 ms 23896 KB Output is correct
3 Correct 6 ms 23900 KB Output is correct
4 Correct 6 ms 23900 KB Output is correct
5 Correct 6 ms 23900 KB Output is correct
6 Correct 6 ms 23900 KB Output is correct
7 Correct 5 ms 23900 KB Output is correct
8 Correct 6 ms 23900 KB Output is correct
9 Correct 6 ms 23900 KB Output is correct
10 Correct 6 ms 23732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 23900 KB Output is correct
2 Correct 6 ms 23900 KB Output is correct
3 Correct 7 ms 23900 KB Output is correct
4 Correct 6 ms 23740 KB Output is correct
5 Correct 5 ms 23896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 25436 KB Output is correct
2 Correct 10 ms 25556 KB Output is correct
3 Correct 12 ms 25692 KB Output is correct
4 Correct 10 ms 25436 KB Output is correct
5 Correct 10 ms 25676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 31580 KB Output is correct
2 Correct 15 ms 31580 KB Output is correct
3 Correct 17 ms 31796 KB Output is correct
4 Correct 20 ms 31580 KB Output is correct
5 Correct 17 ms 31580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 23896 KB Output is correct
2 Correct 6 ms 23896 KB Output is correct
3 Correct 6 ms 23900 KB Output is correct
4 Correct 6 ms 23900 KB Output is correct
5 Correct 6 ms 23900 KB Output is correct
6 Correct 6 ms 23900 KB Output is correct
7 Correct 5 ms 23900 KB Output is correct
8 Correct 6 ms 23900 KB Output is correct
9 Correct 6 ms 23900 KB Output is correct
10 Correct 6 ms 23732 KB Output is correct
11 Correct 6 ms 23900 KB Output is correct
12 Correct 6 ms 23900 KB Output is correct
13 Correct 7 ms 23900 KB Output is correct
14 Correct 6 ms 23740 KB Output is correct
15 Correct 5 ms 23896 KB Output is correct
16 Correct 10 ms 25436 KB Output is correct
17 Correct 10 ms 25556 KB Output is correct
18 Correct 12 ms 25692 KB Output is correct
19 Correct 10 ms 25436 KB Output is correct
20 Correct 10 ms 25676 KB Output is correct
21 Correct 18 ms 31580 KB Output is correct
22 Correct 15 ms 31580 KB Output is correct
23 Correct 17 ms 31796 KB Output is correct
24 Correct 20 ms 31580 KB Output is correct
25 Correct 17 ms 31580 KB Output is correct
26 Correct 21 ms 28252 KB Output is correct
27 Correct 16 ms 27884 KB Output is correct
28 Correct 17 ms 27892 KB Output is correct
29 Correct 16 ms 27736 KB Output is correct
30 Correct 18 ms 28304 KB Output is correct