# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
673383 | Farhan_HY | Programiranje (COCI17_programiranje) | C++14 | 47 ms | 13648 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 IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define T int t;cin >> t;while(t--)
#define int long long
#define F first
#define S second
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 6;
int q, pre[30][N];
string s;
main() {
IOS
cin >> s;
int n = s.size();
s = '.' + s;
for(int i = 1; i <= n; i++) {
pre[s[i] - 'a'][i]++;
for(int j = 0; j < 30; j++) pre[j][i] += pre[j][i - 1];
}
cin >> q;
while(q--) {
int a, b, c, d;
cin >> a >> b >> c >> d;
bool ok = 1;
for(int i = 0; i < 30; i++)
ok &= (pre[i][b] - pre[i][a - 1]) == (pre[i][d] - pre[i][c - 1]);
if(ok) cout << "DA\n";
else cout << "NE\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |