# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947474 | vjudge1 | Programiranje (COCI17_programiranje) | C++17 | 15 ms | 5976 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>
#define fi first
#define se second
using namespace std;
using ll = long long;
const int maxN = 5e4 + 1;
const int MOD = 1e9 + 7;
string s;
int n, q, pre[maxN][26];
void ReadInput()
{
cin >> s;
n = s.size();
s = " " + s;
}
void Solve()
{
for (int i = 1; i <= n; i++)
{
pre[i][s[i] - 'a']++;
for (int j = 0; j < 26; j++)
pre[i][j] += pre[i - 1][j];
}
int A, B, C, D;
cin >> q;
while (q--)
{
cin >> A >> B >> C >> D;
bool flag = true;
for (int j = 0; j < 26; j++)
if (pre[B][j] - pre[A - 1][j] != pre[D][j] - pre[C - 1][j])
{
flag = false;
break;
}
if (flag) cout << "DA\n";
else cout << "NE\n";
}
}
#define task ""
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//freopen(task".INP", "r", stdin);
//freopen(task".OUT", "w", stdout);
int T = 1;
//cin >> T;
while (T--)
{
ReadInput();
Solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |