Submission #925619

# Submission time Handle Problem Language Result Execution time Memory
925619 2024-02-12T06:20:58 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
60 / 100
10 ms 11216 KB
#include<bits/stdc++.h>
using namespace  std;
#define ll long long
#define lld long long double
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define IShowSpeed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=2e5+100;
const int mod=1e9+7;
const int K=500;
const ll inf=1e18+1337;
const int dx[]={-1, 0, 0, 1};
const int dy[]={0, -1, 1, 0};
ll h[K+10][K+10];
vector< pair<ll,ll> >v;

int main()
{
	IShowSpeed
	ll n,m,d,k,ans=0;
	for(int i=0;i<=K;i++) for(int j=0;j<=K;j++) h[i][j]=0;
	cin>>n>>m>>d>>k;
	for(int i=1;i<=n;i++)
	{
		ll sum=0;
		for(int j=1;j<=m;j++)
		{
			char c;
			cin>>c;
			if(c=='S') sum++;
			if(c=='M') v.pb({i,j});
			h[i][j]=sum;
		}
	}
	for(auto p: v)
	{
		ll x=p.F,y=p.S,sum=0;
		for(int i=max(1ll,x-d);i<=min(n,x+d);i++)
		{
			sum+=h[i][min(m,y+d)]-h[i][max(0ll,y-d-1)];
		}
		if(sum>=k) ans++;
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 5 ms 2396 KB Output is correct
4 Correct 3 ms 2392 KB Output is correct
5 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 11216 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 4 ms 2396 KB Output is correct
17 Correct 3 ms 2396 KB Output is correct
18 Correct 5 ms 2396 KB Output is correct
19 Correct 3 ms 2392 KB Output is correct
20 Correct 3 ms 2396 KB Output is correct
21 Runtime error 10 ms 11216 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -