Submission #624933

# Submission time Handle Problem Language Result Execution time Memory
624933 2022-08-09T07:16:52 Z DrollWolf Programiranje (COCI17_programiranje) C++17
40 / 80
3000 ms 744 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long int lli;

//const int N = 50e5+5;
//int arr[N];
 
int main()
{
	lli q, a, b, c, d, i, j;
	string str;
	cin>>str>>q;
	for(i=0;i<q;i++)
	{
		cin>>a>>b>>c>>d;
		if((b-a+1)==(d-c+1))
		{
			string s1= str.substr(a-1, b-a+1);
			string s2= str.substr(c-1, d-c+1);
			sort(s1.begin(), s1.end());
			sort(s2.begin(), s2.end());
			if(s1==s2)
				cout<<"DA"<<'\n';
			else
				cout<<"NE"<<'\n';
		}
		else
			cout<<"NE"<<'\n';
	}
	//freopen("diamond.in","r",stdin);
	//freopen("diamond.out","w",stdout);
}

Compilation message

programiranje.cpp: In function 'int main()':
programiranje.cpp:11:24: warning: unused variable 'j' [-Wunused-variable]
   11 |  lli q, a, b, c, d, i, j;
      |                        ^
# Verdict Execution time Memory Grader output
1 Correct 31 ms 380 KB Output is correct
2 Correct 30 ms 340 KB Output is correct
3 Correct 33 ms 340 KB Output is correct
4 Correct 29 ms 376 KB Output is correct
5 Correct 29 ms 340 KB Output is correct
6 Execution timed out 3057 ms 744 KB Time limit exceeded
7 Execution timed out 3075 ms 728 KB Time limit exceeded
8 Execution timed out 3056 ms 732 KB Time limit exceeded
9 Execution timed out 3077 ms 728 KB Time limit exceeded
10 Execution timed out 3070 ms 728 KB Time limit exceeded