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