Submission #863731

# Submission time Handle Problem Language Result Execution time Memory
863731 2023-10-20T18:34:15 Z TAhmed33 Inside information (BOI21_servers) C++
0 / 100
176 ms 1208 KB
#include <bits/stdc++.h>
using namespace std;
//ana batfeshe55
const int MAXN = 120025;
int arr[MAXN]; int cnt = 0;
bool vis[MAXN];
int main () {
	int n, k;
	cin >> n >> k;	
	vis[1] = 1;
	for (int i = 1; i <= n + k - 1; i++) {
		char c;
		cin >> c;
		if (c == 'S') {
			int x, y;
			cin >> x >> y;
			if (x > y) swap(x, y);
			arr[y] = cnt++;
		} else if (c == 'Q') {
			int x, y;
			cin >> x >> y;
			if (x == y) {
				cout << "yes\n";
				continue;
			}
			if (!vis[y] || !vis[x]) {
				cout << "no\n";
				continue;
			}
			if (x == 1 || y == 1) {
				cout << "yes\n";
				continue;
			}
			if (arr[y] < arr[x]) {
				cout << "yes\n";
			} else {
				cout << "no\n";
			}
		} else {
			int x;
			cin >> x;
			if (!vis[x]) {
				cout << 1 << '\n';
				continue;
			}
			if (x == 1) {
				cout << cnt + 1 << '\n';
				continue;
			}
			cout << arr[x] + 2 << '\n';
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 176 ms 1208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 176 ms 1208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -