#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
//const int N = 50e5+5;
//int arr[N];
int main()
{
lli q, a, b, c, d, i, j;
string str;
cin>>str>>q;
for(i=0;i<q;i++)
{
cin>>a>>b>>c>>d;
vector<lli> x(26, 0);
vector<lli> y(26, 0);
if((b-a+1)==(d-c+1))
{
for(j=a-1;j<b;j++)
x[str[j]-'a']++;
for(j=c-1;j<d;j++)
y[str[j]-'a']++;
bool ans=true;
for(j=0;j<b-a+1;j++)
{
if(x[j]!=y[j])
{
ans=false;
break;
}
}
if(ans)
cout<<"DA"<<'\n';
else
cout<<"NE"<<'\n';
}
else
cout<<"NE"<<'\n';
}
//freopen("diamond.in","r",stdin);
//freopen("diamond.out","w",stdout);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
312 KB |
Output isn't correct |
3 |
Incorrect |
6 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
6 ms |
308 KB |
Output isn't correct |
6 |
Execution timed out |
3045 ms |
1048 KB |
Time limit exceeded |
7 |
Execution timed out |
3080 ms |
1012 KB |
Time limit exceeded |
8 |
Execution timed out |
3039 ms |
1248 KB |
Time limit exceeded |
9 |
Execution timed out |
3063 ms |
1300 KB |
Time limit exceeded |
10 |
Execution timed out |
3058 ms |
1024 KB |
Time limit exceeded |