// 01001100 01001111 01010100 01000001 \\
// \\
// ╦ ╔═╗╔╦╗╔═╗ \\
// ║ ║ ║ ║ ╠═╣ \\
// ╩═╝╚═╝ ╩ ╩ ╩ \\
// \\
// 01001100 01001111 01010100 01000001 \\
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define ld long double
#define terminator main
#define pll pair<ll,ll>
#define add insert
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const int N = 1e5 + 6;
int a[N][26];
void query(){
int l, r, x, y;
cin >> l >> r >> x >> y;
for(int i = 0; i < 26; i++){
if(a[r][i] - a[l - 1][i] != a[y][i] - a[x - 1][i]){
cout << "NE\n";
return;
}
}
cout << "DA\n";
}
void solve(){
string s;
int n, m, q;
cin >> s;
n = s.size();
for(int i = 0; i < n; i++){
m = s[i] - 'a';
for(int j = 0; j < 26; j++)
a[i + 1][j] = a[i][j] + (m == j);
}
cin >> q;
while(q--)
query();
}
int terminator(){
L0TA;
int T = 1;
//cin >> T;
while(T--)
solve();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |