# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
471508 | 2021-09-09T15:32:00 Z | rainboy | Programiranje (COCI17_programiranje) | C | 33 ms | 6616 KB |
#include <stdio.h> #include <string.h> #define N 50000 #define A 26 int main() { static char cc[N + 1]; static int kk[A][N]; int n, q, a, i; scanf("%s", cc), n = strlen(cc); for (a = 0; a < A; a++) for (i = 0; i < n; i++) kk[a][i] = (i == 0 ? 0 : kk[a][i - 1]) + (cc[i] == a + 'a' ? 1 : 0); scanf("%d", &q); while (q--) { int l1, r1, l2, r2, da; scanf("%d%d%d%d", &l1, &r1, &l2, &r2), l1--, r1--, l2--, r2--; da = 1; for (a = 0; a < A; a++) if (kk[a][r1] - (l1 == 0 ? 0 : kk[a][l1 - 1]) != kk[a][r2] - (l2 == 0 ? 0 : kk[a][l2 - 1])) { da = 0; break; } printf(da ? "DA\n" : "NE\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 460 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 460 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 33 ms | 6564 KB | Output is correct |
7 | Correct | 29 ms | 6596 KB | Output is correct |
8 | Correct | 32 ms | 6616 KB | Output is correct |
9 | Correct | 29 ms | 6604 KB | Output is correct |
10 | Correct | 29 ms | 6604 KB | Output is correct |