# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
942536 | skywwla | Programiranje (COCI17_programiranje) | C++17 | 27 ms | 21240 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 5;
string s;
int cnt[26][N], n, q ;
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> s ; n = s.size() ;
s = '#' + s;
for (int i = 1 ; i <= n ; i++) {
cnt[s[i] - 'a'][i] = 1 ;
}
for (int i = 0 ; i < 26 ; i++) {
for (int j = 1 ; j <= n ; j++) {
cnt[i][j] += cnt[i][j - 1] ;
}
}
cin >> q ;
while (q--) {
int a, b, c, d; cin >> a >> b >> c >> d ;
bool ok = 1 ;
for (int i = 0 ; i < 26 ; i++) {
bool x = cnt[i][b] - cnt[i][a - 1] ;
bool y = cnt[i][d] - cnt[i][c - 1] ;
ok &= (x == y) ;
}
cout << (ok ? "DA" : "NE") << "\n" ;
}
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |