QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#422563 | #8093. Jigglypuff | Afterlife# | WA | 1ms | 3996kb | C++17 | 807b | 2024-05-27 16:18:15 | 2024-05-27 16:18:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=3111;
int n,m;
string s[N];
int v[N][N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>s[i];
s[i]=' '+s[i];
}
int ans=0;
for(int i=1;i<n;i++)
for(int j=1;j<m;j++)
{
v[i][j]=v[i-1][j]|v[i][j-1];
if(s[i][j+1]==s[i+1][j])
v[i][j]=1;
}
for(int i=1;i+1<n;i++)
for(int j=1;j<m;j++)
if(s[i][j+1]==s[i+1][j]&&s[i+1][j+1]==s[i+2][j])
ans=1;
for(int i=1;i<n;i++)
for(int j=1;j+1<m;j++)
if(s[i][j+1]==s[i+1][j]&&s[i+1][j+1]==s[i][j+2])
ans=1;
cout<<(ans?"YES":"NO")<<"\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3988kb
input:
5 8 petrozav eiiiziio tiiiavid riiiiois ozavodsk
output:
YES
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 3996kb
input:
5 5 abcde fghij klmno pqrst uvwxy
output:
NO
result:
ok answer is NO
Test #3:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 2 ab bc
output:
NO
result:
ok answer is NO
Test #4:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
2 3 mee eep
output:
YES
result:
ok answer is YES
Test #5:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 2 aa aa
output:
NO
result:
ok answer is NO
Test #6:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
3 2 xx xx xx
output:
YES
result:
ok answer is YES
Test #7:
score: -100
Wrong Answer
time: 1ms
memory: 3740kb
input:
3 3 abc bde feg
output:
NO
result:
wrong answer expected YES, found NO