#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
const int inf=1e11+7;
const int N=107;
const int mod =1000000007;
vector <int> adj[N];
void solve()
{
string s;
cin>>s;
int q;
cin>>q;
while(q--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
string x="",y="";
for(int i=a-1;i<b;i++)
{
x.push_back(s[i]);
}
for(int i=c-1;i<d;i++)
{
y.push_back(s[i]);
}
sort(x.begin(),x.end());
sort(y.begin(),y.end());
if(x==y)
{
cout << "DA" << "\n";
}
else
{
cout << "NE" << '\n';
}
}
}
signed main()
{
fast
clock_t start, end;
start = clock();
solve();
end = clock();
double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
//cout << "time taken" << " " << time_taken << "\n";
}
Compilation message
programiranje.cpp: In function 'int main()':
programiranje.cpp:50:12: warning: unused variable 'time_taken' [-Wunused-variable]
50 | double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
| ^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
340 KB |
Output is correct |
2 |
Correct |
35 ms |
340 KB |
Output is correct |
3 |
Correct |
30 ms |
340 KB |
Output is correct |
4 |
Correct |
31 ms |
340 KB |
Output is correct |
5 |
Correct |
32 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
3065 ms |
1064 KB |
Time limit exceeded |
7 |
Execution timed out |
3059 ms |
908 KB |
Time limit exceeded |
8 |
Execution timed out |
3059 ms |
920 KB |
Time limit exceeded |
9 |
Execution timed out |
3068 ms |
1028 KB |
Time limit exceeded |
10 |
Execution timed out |
3074 ms |
924 KB |
Time limit exceeded |