Submission #550520

# Submission time Handle Problem Language Result Execution time Memory
550520 2022-04-18T10:41:40 Z LittleCube Inside information (BOI21_servers) C++14
5 / 100
547 ms 4468 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int N, K, c[4005];
bitset<4005> b[4005];


signed main()
{
	cin >> N >> K;
	K += N - 1;
	for(int i = 1; i <= N; i++)
		b[i][i] = 1;
	for(int i = 1; i <= K; i++)
	{
		char t;
	   	int	A, B;
		cin >> t;
		if(t == 'C')
			cin >> A;
		else
			cin >> A >> B;
		
		if(t == 'S')
		{
			b[A] |= b[B];
			b[B] |= b[A];
		}
		else if(t == 'C')
		{
			int cnt = 0;
			for(int i = 1; i <= N; i++)
				cnt += b[i][A];	
			cout << cnt << '\n';
		}
		else if(t == 'Q')
			cout << (b[A][B] ? "yes\n" : "no\n");

	}	
}
# Verdict Execution time Memory Grader output
1 Correct 189 ms 1540 KB Output is correct
2 Correct 205 ms 3980 KB Output is correct
3 Correct 204 ms 3940 KB Output is correct
4 Correct 202 ms 4104 KB Output is correct
5 Correct 215 ms 3948 KB Output is correct
6 Correct 207 ms 3932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 189 ms 1540 KB Output is correct
2 Correct 205 ms 3980 KB Output is correct
3 Correct 204 ms 3940 KB Output is correct
4 Correct 202 ms 4104 KB Output is correct
5 Correct 215 ms 3948 KB Output is correct
6 Correct 207 ms 3932 KB Output is correct
7 Correct 186 ms 1472 KB Output is correct
8 Correct 547 ms 3672 KB Output is correct
9 Correct 430 ms 3720 KB Output is correct
10 Correct 511 ms 3736 KB Output is correct
11 Correct 462 ms 3616 KB Output is correct
12 Correct 495 ms 3968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 193 ms 1540 KB Output is correct
2 Runtime error 3 ms 4436 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 193 ms 1540 KB Output is correct
2 Runtime error 3 ms 4436 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 192 ms 1644 KB Output is correct
2 Runtime error 3 ms 4412 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 192 ms 1644 KB Output is correct
2 Runtime error 3 ms 4412 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 199 ms 1532 KB Output is correct
2 Runtime error 3 ms 4436 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 199 ms 1532 KB Output is correct
2 Runtime error 3 ms 4436 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 198 ms 1660 KB Output is correct
2 Runtime error 3 ms 4468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 198 ms 1660 KB Output is correct
2 Runtime error 3 ms 4468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 190 ms 1544 KB Output is correct
2 Correct 209 ms 3960 KB Output is correct
3 Correct 209 ms 3952 KB Output is correct
4 Correct 207 ms 3980 KB Output is correct
5 Correct 206 ms 3916 KB Output is correct
6 Correct 214 ms 4052 KB Output is correct
7 Correct 187 ms 1716 KB Output is correct
8 Runtime error 3 ms 4436 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 190 ms 1544 KB Output is correct
2 Correct 209 ms 3960 KB Output is correct
3 Correct 209 ms 3952 KB Output is correct
4 Correct 207 ms 3980 KB Output is correct
5 Correct 206 ms 3916 KB Output is correct
6 Correct 214 ms 4052 KB Output is correct
7 Correct 187 ms 1716 KB Output is correct
8 Runtime error 3 ms 4436 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -