이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# 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;
}
컴파일 시 표준 에러 (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... |