#include <bits/stdc++.h>
using namespace std;
int q, a, b, c, d, k, m[100], n, t;
string s, x, y;
int main()
{
cin >> s;
k = s.length();
s = ' ' + s;
cin >> q;
while(q--) {
t = 0;
cin >> a >> b >> c >> d;
if (b -a != d - c) {
cout << "NE" << '\n';
continue;
}
x = s.substr(a, b - a + 1);
y = s.substr(c, d - c + 1);
sort(x.begin(), x.end());
sort(y.begin(), y.end());
if(x == y) cout << "DA\n";
else cout << "NE\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
384 KB |
Output is correct |
2 |
Correct |
39 ms |
384 KB |
Output is correct |
3 |
Correct |
38 ms |
384 KB |
Output is correct |
4 |
Correct |
39 ms |
384 KB |
Output is correct |
5 |
Correct |
39 ms |
256 KB |
Output is correct |
6 |
Execution timed out |
3073 ms |
1192 KB |
Time limit exceeded |
7 |
Execution timed out |
3098 ms |
908 KB |
Time limit exceeded |
8 |
Execution timed out |
3098 ms |
880 KB |
Time limit exceeded |
9 |
Execution timed out |
3093 ms |
1148 KB |
Time limit exceeded |
10 |
Execution timed out |
3069 ms |
1124 KB |
Time limit exceeded |