Submission #224479

#TimeUsernameProblemLanguageResultExecution timeMemory
224479baoduytran0104Programiranje (COCI17_programiranje)C++14
40 / 80
3098 ms1192 KiB
#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";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...