# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115708 | luciocf | Programiranje (COCI17_programiranje) | C++14 | 45 ms | 5752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4+10;
const int maxc = 30;
int freq[maxc][maxn];
int main(void)
{
string s;
cin >> s;
int n = s.size();
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 26; j++)
freq[j][i+1] = freq[j][i];
freq[(int)s[i]-(int)'a'][i+1] = freq[(int)s[i]-(int)'a'][i]+1;
}
int q;
scanf("%d", &q);
for (int i = 1; i <= q; i++)
{
int a, b, c, d;
scanf("%d %d %d %d", &a, &b, &c, &d);
if (b-a != d-c)
{
printf("NE\n");
continue;
}
bool ok = 1;
for (int j = 0; j < 26; j++)
if (freq[j][b]-freq[j][a-1] != freq[j][d]-freq[j][c-1])
ok = 0;
if (ok) printf("DA\n");
else printf("NE\n");
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |