Submission #236063

#TimeUsernameProblemLanguageResultExecution timeMemory
236063VEGAnnProgramiranje (COCI17_programiranje)C++14
80 / 80
34 ms5760 KiB
#include <bits/stdc++.h> #define sz(x) ((int)x.size()) using namespace std; const int N = 50100; string s; int n, suf[N][26]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _LOCAL freopen("in.txt","r",stdin); #endif // _LOCAL cin >> s; n = sz(s); for (int i = 0; i < 26; i++) suf[n][i] = 0; for (int i = n - 1; i >= 0; i--){ for (int j = 0; j < 26; j++) suf[i][j] = suf[i + 1][j]; suf[i][s[i] - 'a']++; } int qq; cin >> qq; for (; qq; qq--){ int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--; d--; bool ok = 1; for (int i = 0; i < 26 && ok; i++) ok &= bool((suf[a][i] - suf[b + 1][i]) == (suf[c][i] - suf[d + 1][i])); cout << (ok ? "DA\n" : "NE\n"); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...