This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
# define flash ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
# define F first
# define S second
# define pb push_back
# define mp make_pair
# define sz(s) s.size()
# define all(x) x.begin(), x.end()
# define allr x.rbegin(), x.rend()
# define in insert
# define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
# define fore(i, l, r) for(int i = l; i <= r; i++)
typedef long long ll;
typedef double db;
typedef long double ld;
using namespace std;
const int N = 2e5 + 5;
const ll inf = 1e9 + 7;
const ll INF = 1e18;
const db pi = acos(-1.0);
int n, q, cnt[N];
int main (){
//file(s);
flash;
cin >> n >> q;
while (q--){
char c;
cin >> c;
if (c == 'S'){
int a;
cin >> a;
if (cnt[a] == 0) cnt[a] = 1;
else cnt[a] = 0;
}
else{
int l, r;
bool ans = 0;
cin >> l >> r;
vector <int> v;
for (int i = l; i <= r; i++){
if (cnt[i] == 1){
v.pb(i);
}
}
for (int i = 0; i < v.size(); i++){
for (int j = 0; j < v.size(); j++){
if (__gcd(v[i], v[j]) != 1 && i != j) ans = 1;
}
}
if (ans == 1) cout << "DA\n";
else cout << "NE\n";
}
}
return 0;
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | for (int i = 0; i < v.size(); i++){
| ~~^~~~~~~~~~
Main.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for (int j = 0; j < v.size(); j++){
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |