# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115715 | Breno_XD | Programiranje (COCI17_programiranje) | C++14 | 2844 ms | 1124 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
string S;
int a,b,c,d, Q;
int palavra1[100];
int palavra2[100];
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> S >> Q;
for(int i = 1; i<=Q; i++){
cin >> a >> b >> c >> d;
for(int k = a; k <= b; k++) palavra1[(int)S[k-1] - 96]++;
for(int k = c; k <= d; k++) palavra2[(int)S[k-1] - 96]++;
/*
for(int k=1; k<=27; k++) cout << palavra1[k] << " ";
cout << endl;
for(int k=1; k<=27; k++) cout << palavra2[k] << " ";
cout << endl;
*/
bool ok = true;
for(int k=1; k<=27; k++){
if(palavra1[k]!=palavra2[k]) ok = false;
palavra1[k] = palavra2[k] = 0;
}
if(ok) cout << "DA\n";
else cout << "NE\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |