Submission #857510

#TimeUsernameProblemLanguageResultExecution timeMemory
857510Trisanu_DasRadio (COCI22_radio)C++17
10 / 110
1 ms436 KiB
#include<bits/stdc++.h>
using namespace std;
 
long long n, m, x, y;
char c;
bool check[201];
 
int main()
{
	cin >> n >> m;
	while(m--)
	{
		cin >> c;
		if(c == 'S')
		{
			cin >> x;
			check[x] = 1 - check[x];
		}
		else
		{
			cin >> x >> y;
			bool chk = 0;
			for(int i = x; i <= y; ++i)
			{
				for(int j = i + 1; j <= y; ++j)
				{
					if(check[i] && check[j] && __gcd(i, j) > 1)
					{
						chk = 1;
						break;
					}
				}
				if(chk)	break;
			}
			if(!chk)	cout << "NE\n";
			else	cout << "DA\n";
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...