#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, x;
string word;
multiset<char> sab;
multiset<char> scd;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> word;
cin >> x;
for (int i=0;i<x;i++){
cin >> a >> b >> c >> d;
for (int j=a;j<b+1;j++) sab.insert(word[j-1]);
for (int j=c;j<d+1;j++) scd.insert(word[j-1]);
if (sab == scd) cout << "DA\n";
else cout << "NE\n";
sab.clear();
scd.clear();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
114 ms |
484 KB |
Output is correct |
2 |
Correct |
126 ms |
520 KB |
Output is correct |
3 |
Correct |
124 ms |
596 KB |
Output is correct |
4 |
Correct |
118 ms |
664 KB |
Output is correct |
5 |
Correct |
116 ms |
756 KB |
Output is correct |
6 |
Execution timed out |
3043 ms |
5536 KB |
Time limit exceeded |
7 |
Execution timed out |
3025 ms |
6048 KB |
Time limit exceeded |
8 |
Execution timed out |
3047 ms |
6076 KB |
Time limit exceeded |
9 |
Execution timed out |
3054 ms |
6420 KB |
Time limit exceeded |
10 |
Execution timed out |
3033 ms |
6516 KB |
Time limit exceeded |