#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int q;
cin >> q;
while(q--){
int a,b,c,d;
cin >> a >> b >> c >> d;
a -= 1;
b -= 1;
c -= 1;
d -= 1;
string x = s.substr(a,b-a+1);
string y = s.substr(c,d-c+1);
sort(x.begin(), x.end());
sort(y.begin(), y.end());
if(x == y) cout << "DA" << endl;
else cout << "NE" << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
340 KB |
Output is correct |
2 |
Correct |
32 ms |
368 KB |
Output is correct |
3 |
Correct |
29 ms |
340 KB |
Output is correct |
4 |
Correct |
29 ms |
340 KB |
Output is correct |
5 |
Correct |
30 ms |
308 KB |
Output is correct |
6 |
Execution timed out |
3056 ms |
728 KB |
Time limit exceeded |
7 |
Execution timed out |
3048 ms |
852 KB |
Time limit exceeded |
8 |
Execution timed out |
3070 ms |
848 KB |
Time limit exceeded |
9 |
Execution timed out |
3083 ms |
856 KB |
Time limit exceeded |
10 |
Execution timed out |
3020 ms |
724 KB |
Time limit exceeded |