# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38170 | wasyl | Programiranje (COCI17_programiranje) | C++11 | 369 ms | 7552 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
#include <iostream>
#include <algorithm>
#define d(...) __VA_ARGS__
#define all(x) (x).begin(), (x).end()
#define eb(...) emplace_back(__VA_ARGS__)
using namespace std;using ll=long long;
template<class t>using V = vector< t >;
V< V< int > > tab;
V< int > foo (int lo, int hi) {
V< int > res (26);
for (int i = 0; i < 26; ++i)
res[i] = tab[i][hi] - tab[i][lo - 1];
return res;
}
int main()
{
ios::sync_with_stdio(false);
string s; cin >> s;
s = 'a' + s;
tab.resize(26, V< int >(s.size()));
for (int i = 0; i < s.size(); ++i)
++tab[s[i] - 'a'][i];
for (int i = 0; i < 26; ++i)
for (int k = 1; k < s.size(); ++k)
tab[i][k] += tab[i][k - 1];
int q; cin >> q;
while (q--) {
int lo, hi, lo2, hi2;
cin >> lo >> hi >> lo2 >> hi2;
V< int > z = foo(lo, hi);
V< int > z2 = foo(lo2, hi2);
int i = 0;
for (; i < 26; ++i)
if (z[i] != z2[i]) {
cout << "NE\n";
break;
}
if (i == 26)
cout << "DA\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |