# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
593508 | starchan | Programiranje (COCI17_programiranje) | C++17 | 64 ms | 11920 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;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
signed main()
{
fast();
string life;
cin >> life;
int q;
cin >> q;
int n = life.length();
int a[26][n+1];
for(int i = 0; i < 26; i++)
{
a[i][0] = 0;
for(int j = 1; j <= n; j++)
a[i][j] = a[i][j-1]+((life[j-1]-'a')==i);
}
while(q--)
{
int x, y, z, w;
string val = "DA";
cin >> x >> y >> z >> w;
for(int i = 0; i < 26; i++)
{
if(a[i][y]-a[i][x-1] != a[i][w]-a[i][z-1])
val = "NE";
}
cout << val << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |