| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 622405 | kabika | Programiranje (COCI17_programiranje) | C++14 | 3095 ms | 1744 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
int q;
cin >> q;
while(q--)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
if(b-a != d-c)
{
cout << "NE\n";
continue;
}
if(a == c && b == d)
{
cout << "DA\n";
continue;
}
if(a >= c && b >= d)
{
swap(a,c);
swap(b,d);
}
//cout << a << " " << b << " " << c << " " << d << '\n';
if(b >= c)
{
int t = b;
b = c-1;
c = t+1;
}
map<char,int> mp;
bool flag = 1;
for(int i = a-1; i < b; ++i)
{
++mp[s[i]];
//cout << s[i] << " " << mp[s[i]] << '\n';
}
for(int i = c-1; i < d; ++i)
{
--mp[s[i]];
//cout << s[i] << " " << mp[s[i]] << '\n';
if(mp[s[i]] < 0)
{
flag = 0;
break;
}
}
//cout << "by flag ";
if(flag)
cout << "DA\n";
else
cout << "NE\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
