#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
string s;
cin>>s;
int q;
cin>>q;
for(int i=0;i<q;i++) {
int a,b,c,d;
cin>>a>>b>>c>>d;
string s1 = "",s2 = "";
int fdif = abs(a-b) +1 ;
s1 += s.substr(a-1,fdif);
int sdif = abs(c-d) +1 ;
s2 += s.substr(c-1,sdif);
sort(s1.begin(),s1.end());
sort(s2.begin(),s2.end());
if (s1 == s2)cout<<"DA"<<endl;
else cout<<"NE"<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
388 KB |
Output is correct |
2 |
Correct |
29 ms |
340 KB |
Output is correct |
3 |
Correct |
30 ms |
468 KB |
Output is correct |
4 |
Correct |
28 ms |
340 KB |
Output is correct |
5 |
Correct |
31 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
3076 ms |
692 KB |
Time limit exceeded |
7 |
Execution timed out |
3070 ms |
644 KB |
Time limit exceeded |
8 |
Execution timed out |
3081 ms |
732 KB |
Time limit exceeded |
9 |
Execution timed out |
3082 ms |
656 KB |
Time limit exceeded |
10 |
Execution timed out |
3087 ms |
672 KB |
Time limit exceeded |