#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
string s;
cin >> s;
int q;
cin >> q;
while (q--) {
int a, b, c, d;
cin >> a >> b >> c >> d;
string x = s.substr(a-1, b-a+1);
string y = s.substr(c-1, d-c+1);
sort(x.begin(), x.end());
sort(y.begin(), y.end());
if (x == y) cout << "DA\n";
else cout << "NE\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
348 KB |
Output is correct |
2 |
Correct |
23 ms |
524 KB |
Output is correct |
3 |
Correct |
23 ms |
348 KB |
Output is correct |
4 |
Correct |
23 ms |
520 KB |
Output is correct |
5 |
Correct |
26 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
3039 ms |
828 KB |
Time limit exceeded |
7 |
Execution timed out |
3050 ms |
872 KB |
Time limit exceeded |
8 |
Execution timed out |
3074 ms |
1080 KB |
Time limit exceeded |
9 |
Execution timed out |
3056 ms |
856 KB |
Time limit exceeded |
10 |
Execution timed out |
3067 ms |
876 KB |
Time limit exceeded |