# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086495 | toast12 | Programiranje (COCI17_programiranje) | C++14 | 29 ms | 7104 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;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
string s;
cin >> s;
vector<vector<int>> ps(26, vector<int>(s.length()+1));
for (int j = 1; j <= s.length(); j++) {
for (int i = 0; i < 26; i++) {
ps[i][j] = ps[i][j-1];
if (i == s[j-1]-'a')
ps[i][j]++;
}
}
int q;
cin >> q;
while (q--) {
int a, b, c, d;
cin >> a >> b >> c >> d;
bool ans = true;
for (int i = 0; i < 26; i++) {
if (ps[i][b]-ps[i][a-1] != ps[i][d]-ps[i][c-1]) {
ans = false;
break;
}
}
if (ans) cout << "DA\n";
else cout << "NE\n";
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |