답안 #857508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
857508 2023-10-06T10:13:22 Z Trisanu_Das Radio (COCI22_radio) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
 
long long n, q;
bool check[201];
 
int main() {
	cin >> n >> q;
	while(q--) {
		char op; cin >> op;
		if(op == 'S') {
			int x; cin >> x;
			a[x] = 1 - a[x];
		}
		else {
			cin >> x >> y;
			bool ans = 0;
			for(int i = x; i <= y; i++) {
				for(int j = i++; j <= y; j++) {
					if(a[i] && a[j] && __gcd(i, j) > 1) {
						ans = 1; break;
					}
				}
				if(ans)	break;
			}
			if(ans) cout << "DA\n"; else cout << "NE\n";
		}
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:13:4: error: 'a' was not declared in this scope
   13 |    a[x] = 1 - a[x];
      |    ^
Main.cpp:16:11: error: 'x' was not declared in this scope
   16 |    cin >> x >> y;
      |           ^
Main.cpp:16:16: error: 'y' was not declared in this scope
   16 |    cin >> x >> y;
      |                ^
Main.cpp:20:9: error: 'a' was not declared in this scope
   20 |      if(a[i] && a[j] && __gcd(i, j) > 1) {
      |         ^