# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
622439 | kabika | Programiranje (COCI17_programiranje) | C++14 | 3079 ms | 1732 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 <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
int q;
cin >> q;
while(q--)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
if(b-a != d-c)
{
cout << "NE\n";
continue;
}
if(a == c && b == d)
{
cout << "DA\n";
continue;
}
if(a >= c && b >= d)
{
swap(a,c);
swap(b,d);
}
if(b >= c)
{
swap(b,c);
--b;
++c;
}
//cout << a << " " << b << " " << c << " " << d << '\n';
string s1(s,a-1,b-a+1);
string s2(s,c-1,d-c+1);
//cout << s1 << " " << s2 << '\n';
sort(s1.begin(),s1.end());
sort(s2.begin(),s2.end());
if(s1 == s2)
cout << "DA\n";
else
cout << "NE\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |