답안 #850222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850222 2023-09-16T05:58:13 Z elotelo966 Programiranje (COCI17_programiranje) C++17
40 / 80
3000 ms 544 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define OYY 100000005
#define mod 100000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define lim 100005
map<char,int> mp;

int32_t main(){
    faster
    string s;cin>>s;
    int n=s.length();
    int q;cin>>q;
    while(q--){
        mp.clear();
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        a--;b--;c--;d--;
        if(b-a!=d-c){
            cout<<"NE"<<'\n';
            continue;
        }
        for(int i=a;i<=b;i++){
            mp[s[i]]++;
        }
        bool stop=true;
        for(int i=c;i<=d && stop;i++){
            if(mp[s[i]]!=0){
                mp[s[i]]--;
            }
            else stop=false;
        }
        if(stop){
            cout<<"DA"<<'\n';
        }
        else cout<<"NE"<<'\n';
    }
	return 0;
}

Compilation message

programiranje.cpp: In function 'int32_t main()':
programiranje.cpp:14:9: warning: unused variable 'n' [-Wunused-variable]
   14 |     int n=s.length();
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 348 KB Output is correct
2 Correct 28 ms 348 KB Output is correct
3 Correct 28 ms 348 KB Output is correct
4 Correct 28 ms 348 KB Output is correct
5 Correct 31 ms 464 KB Output is correct
6 Execution timed out 3050 ms 544 KB Time limit exceeded
7 Execution timed out 3003 ms 540 KB Time limit exceeded
8 Execution timed out 3093 ms 540 KB Time limit exceeded
9 Execution timed out 3060 ms 536 KB Time limit exceeded
10 Execution timed out 3044 ms 540 KB Time limit exceeded