# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94622 | ahmedie404 | Programiranje (COCI17_programiranje) | C++14 | 4 ms | 1144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
string s, s1, s2;
int n;
int a, b, c, d;
int x[27];
int y[27];
int main(){
cin >> s;
cin >> n;
while(n--){
cin >> a >> b >> c >> d;
if(d-c != b-a){
cout << "NE" << endl;
continue;
}
s1 = s.substr(a-1,b-a+1);
s2 = s.substr(c-1,d-c+1);
for(int i=0;i<26;i++) x[i]=0, y[i]=0;
for(int i=0;i<s1.length();i++)
x[(int)s1[i] - 87]++, y[(int)s2[i] - 87]++;
bool f=true;
for(int i=0;i<26;i++)
if(x[i] != y[i]){
f=false;
break;
}
if(f==true)
cout << "DA" << endl;
else
cout << "NE" << endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |