# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
673383 | Farhan_HY | Programiranje (COCI17_programiranje) | C++14 | 47 ms | 13648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |