#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define OYY 100000005
#define mod 100000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define lim 100005
int32_t main(){
faster
string s;cin>>s;
int n=s.length();
int q;cin>>q;
while(q--){
int a,b,c,d;
cin>>a>>b>>c>>d;
a--;b--;c--;d--;
if(b-a!=d-c){
cout<<"NE"<<'\n';
continue;
}
string deg="",deg1="";
deg=s,deg1=s;
sort(deg.begin()+a,deg.begin()+b+1);
sort(deg1.begin()+c,deg1.begin()+d+1);
cout<<deg<<" "<<deg1<<endl;
if(deg==deg1){
cout<<"DA"<<'\n';
}
else cout<<"NE"<<'\n';
}
return 0;
}
Compilation message
programiranje.cpp: In function 'int32_t main()':
programiranje.cpp:13:9: warning: unused variable 'n' [-Wunused-variable]
13 | int n=s.length();
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
2392 KB |
Output isn't correct |
2 |
Incorrect |
26 ms |
2428 KB |
Output isn't correct |
3 |
Incorrect |
26 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
26 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
26 ms |
2212 KB |
Output isn't correct |
6 |
Runtime error |
2260 ms |
65536 KB |
Execution killed with signal 9 |
7 |
Execution timed out |
3459 ms |
65536 KB |
Time limit exceeded |
8 |
Execution timed out |
3426 ms |
65536 KB |
Time limit exceeded |
9 |
Execution timed out |
3473 ms |
65536 KB |
Time limit exceeded |
10 |
Execution timed out |
3461 ms |
65536 KB |
Time limit exceeded |