Submission #593508

#TimeUsernameProblemLanguageResultExecution timeMemory
593508starchanProgramiranje (COCI17_programiranje)C++17
80 / 80
64 ms11920 KiB
#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 timeMemoryGrader output
Fetching results...