# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1113825 |
2024-11-17T14:02:34 Z |
EfeBabagil |
Toy (CEOI24_toy) |
C++14 |
|
16 ms |
7248 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int visk[1505][1505];
int visl[1505][1505];
int32_t main()
{
int w, h, k, l;
cin>>w>>h>>k>>l;
int kh,lh,lw,kw;
cin>>kw>>kh>>lw>>lh;
char arr[h][w];
queue<pair<int,int>> q;
pair<int,int> sk,sl,e;
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
cin>>arr[i][j];
if (arr[i][j] == '*')
{
e = {i,j};
}
}
}
sk={kh,kw};
q.push(sk);
visk[sk.first][sk.second] = 1;
while (!q.empty())
{
pair<int, int> u = q.front();
q.pop();
for (int i = 0; i < 4; i++) {
pair<int, int> v = {u.first + dx[i], u.second + dy[i]};
if (v.first < 0 || v.first >= h || v.second < 0 || v.second >= w-k+1) continue;
int flag=0;
for(int j=0;j<k;j++)
{
if (arr[v.first][v.second+j] == 'X')
{
flag=1;
break;
}
}
if(flag)
continue;
if (visk[v.first][v.second])
continue;
visk[v.first][v.second] = 1;
q.push(v);
}
}
sl={lh,lw};
q.push(sl);
visl[sl.first][sl.second] = 1;
while (!q.empty())
{
pair<int, int> u = q.front();
q.pop();
for (int i = 0; i < 4; i++) {
pair<int, int> v = {u.first + dx[i], u.second + dy[i]};
if (v.first < 0 || v.first >= h-l+1 || v.second < 0 || v.second >= w) continue;
int flag=0;
for(int j=0;j<k;j++)
{
if (arr[v.first+j][v.second] == 'X')
{
flag=1;
break;
}
}
if(flag)
continue;
if (visl[v.first][v.second])
continue;
visl[v.first][v.second] = 1;
q.push(v);
}
}
/*
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
cout<<visk[i][j]<<" ";
}
cout<<endl;
}
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
cout<<visl[i][j]<<" ";
}
cout<<endl;
}*/
int control1=0;
int control2=0;
for(int i=0;i<k;i++){
if(e.second-i<0)
continue;
if(visk[e.first][e.second-i])
{
control1=1;
}
}
for(int i=0;i<l;i++){
if(e.first-i<0)
continue;
if(visl[e.first-i][e.second])
{
control2=1;
}
}
//cout<<control1<<" "<<control2<<endl;
if(control1&&control2)
cout<<"YES";
else
cout<<"NO";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
4432 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
4432 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
1 ms |
4432 KB |
Output is correct |
4 |
Correct |
8 ms |
6480 KB |
Output is correct |
5 |
Correct |
10 ms |
5968 KB |
Output is correct |
6 |
Correct |
2 ms |
4600 KB |
Output is correct |
7 |
Correct |
10 ms |
6128 KB |
Output is correct |
8 |
Correct |
16 ms |
6480 KB |
Output is correct |
9 |
Correct |
3 ms |
2896 KB |
Output is correct |
10 |
Correct |
6 ms |
3920 KB |
Output is correct |
11 |
Correct |
4 ms |
4432 KB |
Output is correct |
12 |
Correct |
2 ms |
4432 KB |
Output is correct |
13 |
Correct |
4 ms |
4432 KB |
Output is correct |
14 |
Correct |
3 ms |
4432 KB |
Output is correct |
15 |
Incorrect |
10 ms |
7248 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
4432 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2552 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
1 ms |
2384 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
4432 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |