# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115705 | pamaj | Programiranje (COCI17_programiranje) | C++14 | 143 ms | 7772 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;
const int MAXN = 5e4 + 10;
int pref[MAXN][30];
int main()
{
string s;
cin >> s;
for(int i = 0; i < s.size(); i++)
{
for(int lt = 0; lt < 26; lt++)
{
pref[i + 1][lt] = pref[i][lt] + (s[i] - 'a' == lt);
}
}
int q;
cin >> q;
while(q--)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
bool ok = true;
for(int i = 0; i < 30; i++)
{
int qt1, qt2;
qt1 = pref[b][i] - pref[a - 1][i];
qt2 = pref[d][i] - pref[c - 1][i];
if(qt1 != qt2)
{
ok = false;
break;
}
}
if(ok) cout << "DA\n";
else cout << "NE\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |