Submission #649586

# Submission time Handle Problem Language Result Execution time Memory
649586 2022-10-10T21:40:03 Z ShahdMohamed Collecting Mushrooms (NOI18_collectmushrooms) C++17
60 / 100
2000 ms 8756 KB
///LW M4 ACC HAZ3L GAMED
///YARAB WALA...I MEAN YARAB ACC
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
const ll mod = (ll) 1e9 + 7;
const ll even = (ll) 1e9 + 2;
const ll oo= (ll) 1e16;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,m,x,y;
    cin>>n>>m>>x>>y;
    vector<vector<char>>v(n,vector<char>(m));
    for (ll i=0; i<n; i++)
    {
        for (ll j=0; j<m; j++)
            cin>>v[i][j];
    }
    vector<vector<ll>>frq(n,vector<ll>(m,0));
    for (ll i=0; i<n; i++)
    {
        for (ll j=0; j<m; j++)
        {
            if (v[i][j]=='S')
            {
                for (ll k=max(0ll,i-x); k<=min(n-1,i+x); k++)
                {
                    for (ll h=max(0ll,j-x); h<=min(m-1,j+x); h++)
                        frq[k][h]++;
                }
            }
        }
    }
    ll ans=0;
    for (ll i=0; i<n; i++)
    {
        for (ll j=0; j<m; j++)
        {
            if (v[i][j]=='M' and frq[i][j]>=y)ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 29 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 29 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 320 KB Output is correct
8 Correct 75 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2132 KB Output is correct
2 Correct 63 ms 2260 KB Output is correct
3 Correct 14 ms 2644 KB Output is correct
4 Correct 107 ms 2260 KB Output is correct
5 Correct 5 ms 2388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2081 ms 8756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 29 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 320 KB Output is correct
8 Correct 75 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 17 ms 2132 KB Output is correct
17 Correct 63 ms 2260 KB Output is correct
18 Correct 14 ms 2644 KB Output is correct
19 Correct 107 ms 2260 KB Output is correct
20 Correct 5 ms 2388 KB Output is correct
21 Execution timed out 2081 ms 8756 KB Time limit exceeded
22 Halted 0 ms 0 KB -