#include <bits/stdc++.h>
#define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
/* ------------------------ hi lol ------------------------ */
int n,x1,x2,x3,x4;
string s,s1,s2;
int main() {
ccd
cin >> s >> n;
for (int i=1;i<=n;i++) {
cin >> x1 >> x2 >> x3 >> x4;
if ((x2-x1)!=(x4-x3)) {
cout << "NE" << endl;
continue;
}
s1=s.substr(x1-1,x2-x1+1);
s2=s.substr(x3-1,x4-x3+1);
// cout << s1 << " " << s2 << " ";
sort(s1.begin(),s1.end());
sort(s2.begin(),s2.end());
cout << (s1==s2 ? "DA" : "NE") << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
340 KB |
Output is correct |
2 |
Correct |
27 ms |
396 KB |
Output is correct |
3 |
Correct |
26 ms |
388 KB |
Output is correct |
4 |
Correct |
30 ms |
340 KB |
Output is correct |
5 |
Correct |
27 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
3062 ms |
924 KB |
Time limit exceeded |
7 |
Execution timed out |
3064 ms |
976 KB |
Time limit exceeded |
8 |
Execution timed out |
3042 ms |
1112 KB |
Time limit exceeded |
9 |
Execution timed out |
3049 ms |
1000 KB |
Time limit exceeded |
10 |
Execution timed out |
3061 ms |
1320 KB |
Time limit exceeded |