# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
673383 | 2022-12-20T13:09:22 Z | Farhan_HY | Programiranje (COCI17_programiranje) | C++14 | 47 ms | 13648 KB |
#include<bits/stdc++.h> #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define T int t;cin >> t;while(t--) #define int long long #define F first #define S second using namespace std; const int mod = 1e9 + 7; const int N = 1e6 + 6; int q, pre[30][N]; string s; main() { IOS cin >> s; int n = s.size(); s = '.' + s; for(int i = 1; i <= n; i++) { pre[s[i] - 'a'][i]++; for(int j = 0; j < 30; j++) pre[j][i] += pre[j][i - 1]; } cin >> q; while(q--) { int a, b, c, d; cin >> a >> b >> c >> d; bool ok = 1; for(int i = 0; i < 30; i++) ok &= (pre[i][b] - pre[i][a - 1]) == (pre[i][d] - pre[i][c - 1]); if(ok) cout << "DA\n"; else cout << "NE\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 724 KB | Output is correct |
2 | Correct | 1 ms | 724 KB | Output is correct |
3 | Correct | 1 ms | 728 KB | Output is correct |
4 | Correct | 1 ms | 724 KB | Output is correct |
5 | Correct | 1 ms | 820 KB | Output is correct |
6 | Correct | 36 ms | 13600 KB | Output is correct |
7 | Correct | 36 ms | 13648 KB | Output is correct |
8 | Correct | 47 ms | 13644 KB | Output is correct |
9 | Correct | 47 ms | 13596 KB | Output is correct |
10 | Correct | 35 ms | 13644 KB | Output is correct |