Submission #570294

# Submission time Handle Problem Language Result Execution time Memory
570294 2022-05-29T07:35:37 Z 장태환(#8350) Inside information (BOI21_servers) C++17
52.5 / 100
3500 ms 22856 KB
#include <bits/stdc++.h>
//Announcing plan to get the test data is probably not a good idea
using namespace std;
bitset<1005>arr[120000];
int ty[300010], b[300100], c[300100];
int ans[300100];
int main()
{
	int N, K;
	cin >> N >> K;
	int i;
	for (i = 0; i < N + K - 1; i++)
	{
		char a;
		cin >> a;
		if (a == 'S')
		{
			ty[i] = 0;
			cin >> b[i] >> c[i];
		}
		else if (a == 'Q')
		{
			ty[i] = 1;
			cin >> b[i] >> c[i];
		}
		else
		{
			ty[i] = 2;
			cin >> b[i];
		}
	}
	for (i = 1; i <= N; i += 1000)
	{
		int j;
		for (j = 1; j <= N; j++)
		{
			arr[j] &= 0;
			if (j >= i && j < i + 1000)
				arr[j].set(j-i);
		}
		for (j = 0; j < N + K - 1; j++)
		{
			if (ty[j] == 0)
			{
				arr[b[j]] |= arr[c[j]];
				arr[c[j]] |= arr[b[j]];
			}
			else if (ty[j] == 1)
			{
				if (c[j] < i || c[j] >= i + 1000)
					continue;
				ans[j] = arr[b[j]][c[j] - i];

			}
			else
			{
				if (b[j] < i || b[j] >= i + 1000)
					continue;
				int k;
				for (k = 1; k <= N; k++)
				{
					ans[j] += arr[k][b[j] - i];
				}
			}
		}
	}
	for (i = 0; i < N + K - 1; i++)
	{
		if (ty[i] == 1)
		{
			cout << (ans[i] ? "yes" : "no") << '\n';
		}
		else if (ty[i] == 2)
			cout << ans[i] << '\n';
	}
	
}
# Verdict Execution time Memory Grader output
1 Correct 51 ms 2536 KB Output is correct
2 Correct 74 ms 3072 KB Output is correct
3 Correct 74 ms 4408 KB Output is correct
4 Correct 75 ms 4376 KB Output is correct
5 Correct 79 ms 4480 KB Output is correct
6 Correct 77 ms 4484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 2536 KB Output is correct
2 Correct 74 ms 3072 KB Output is correct
3 Correct 74 ms 4408 KB Output is correct
4 Correct 75 ms 4376 KB Output is correct
5 Correct 79 ms 4480 KB Output is correct
6 Correct 77 ms 4484 KB Output is correct
7 Correct 53 ms 3360 KB Output is correct
8 Correct 337 ms 4260 KB Output is correct
9 Correct 328 ms 4164 KB Output is correct
10 Correct 318 ms 4120 KB Output is correct
11 Correct 299 ms 4136 KB Output is correct
12 Correct 294 ms 4320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2636 KB Output is correct
2 Correct 1855 ms 19460 KB Output is correct
3 Correct 1825 ms 22304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2636 KB Output is correct
2 Correct 1855 ms 19460 KB Output is correct
3 Correct 1825 ms 22304 KB Output is correct
4 Correct 58 ms 3460 KB Output is correct
5 Execution timed out 3567 ms 21896 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2508 KB Output is correct
2 Correct 1890 ms 19488 KB Output is correct
3 Correct 2071 ms 19460 KB Output is correct
4 Correct 778 ms 22784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2508 KB Output is correct
2 Correct 1890 ms 19488 KB Output is correct
3 Correct 2071 ms 19460 KB Output is correct
4 Correct 778 ms 22784 KB Output is correct
5 Correct 54 ms 3376 KB Output is correct
6 Execution timed out 3567 ms 22060 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2484 KB Output is correct
2 Correct 777 ms 19472 KB Output is correct
3 Correct 2096 ms 22504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2484 KB Output is correct
2 Correct 777 ms 19472 KB Output is correct
3 Correct 2096 ms 22504 KB Output is correct
4 Correct 55 ms 3328 KB Output is correct
5 Execution timed out 3562 ms 22092 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 2468 KB Output is correct
2 Correct 1968 ms 19472 KB Output is correct
3 Correct 2029 ms 19512 KB Output is correct
4 Correct 788 ms 22712 KB Output is correct
5 Correct 55 ms 3404 KB Output is correct
6 Correct 801 ms 22744 KB Output is correct
7 Correct 2222 ms 22644 KB Output is correct
8 Correct 2049 ms 22644 KB Output is correct
9 Correct 1951 ms 22712 KB Output is correct
10 Correct 1906 ms 22848 KB Output is correct
11 Correct 1941 ms 22752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 2468 KB Output is correct
2 Correct 1968 ms 19472 KB Output is correct
3 Correct 2029 ms 19512 KB Output is correct
4 Correct 788 ms 22712 KB Output is correct
5 Correct 55 ms 3404 KB Output is correct
6 Correct 801 ms 22744 KB Output is correct
7 Correct 2222 ms 22644 KB Output is correct
8 Correct 2049 ms 22644 KB Output is correct
9 Correct 1951 ms 22712 KB Output is correct
10 Correct 1906 ms 22848 KB Output is correct
11 Correct 1941 ms 22752 KB Output is correct
12 Correct 56 ms 3388 KB Output is correct
13 Execution timed out 3573 ms 22120 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2540 KB Output is correct
2 Correct 79 ms 3032 KB Output is correct
3 Correct 87 ms 4424 KB Output is correct
4 Correct 92 ms 4468 KB Output is correct
5 Correct 88 ms 4476 KB Output is correct
6 Correct 78 ms 4512 KB Output is correct
7 Correct 59 ms 3376 KB Output is correct
8 Correct 1794 ms 22308 KB Output is correct
9 Correct 1857 ms 22304 KB Output is correct
10 Correct 56 ms 3404 KB Output is correct
11 Correct 2100 ms 22780 KB Output is correct
12 Correct 2045 ms 22784 KB Output is correct
13 Correct 821 ms 22836 KB Output is correct
14 Correct 66 ms 3404 KB Output is correct
15 Correct 786 ms 22692 KB Output is correct
16 Correct 2198 ms 22568 KB Output is correct
17 Correct 2071 ms 22648 KB Output is correct
18 Correct 2147 ms 22712 KB Output is correct
19 Correct 1842 ms 22804 KB Output is correct
20 Correct 1993 ms 22796 KB Output is correct
21 Correct 1766 ms 22832 KB Output is correct
22 Correct 1935 ms 22856 KB Output is correct
23 Correct 1957 ms 22660 KB Output is correct
24 Correct 1885 ms 22772 KB Output is correct
25 Correct 2081 ms 22788 KB Output is correct
26 Correct 1768 ms 22456 KB Output is correct
27 Correct 1780 ms 22488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2540 KB Output is correct
2 Correct 79 ms 3032 KB Output is correct
3 Correct 87 ms 4424 KB Output is correct
4 Correct 92 ms 4468 KB Output is correct
5 Correct 88 ms 4476 KB Output is correct
6 Correct 78 ms 4512 KB Output is correct
7 Correct 59 ms 3376 KB Output is correct
8 Correct 1794 ms 22308 KB Output is correct
9 Correct 1857 ms 22304 KB Output is correct
10 Correct 56 ms 3404 KB Output is correct
11 Correct 2100 ms 22780 KB Output is correct
12 Correct 2045 ms 22784 KB Output is correct
13 Correct 821 ms 22836 KB Output is correct
14 Correct 66 ms 3404 KB Output is correct
15 Correct 786 ms 22692 KB Output is correct
16 Correct 2198 ms 22568 KB Output is correct
17 Correct 2071 ms 22648 KB Output is correct
18 Correct 2147 ms 22712 KB Output is correct
19 Correct 1842 ms 22804 KB Output is correct
20 Correct 1993 ms 22796 KB Output is correct
21 Correct 1766 ms 22832 KB Output is correct
22 Correct 1935 ms 22856 KB Output is correct
23 Correct 1957 ms 22660 KB Output is correct
24 Correct 1885 ms 22772 KB Output is correct
25 Correct 2081 ms 22788 KB Output is correct
26 Correct 1768 ms 22456 KB Output is correct
27 Correct 1780 ms 22488 KB Output is correct
28 Correct 54 ms 3424 KB Output is correct
29 Correct 374 ms 4116 KB Output is correct
30 Correct 332 ms 4212 KB Output is correct
31 Correct 301 ms 4132 KB Output is correct
32 Correct 347 ms 4120 KB Output is correct
33 Correct 418 ms 4276 KB Output is correct
34 Correct 55 ms 3404 KB Output is correct
35 Execution timed out 3538 ms 21844 KB Time limit exceeded
36 Halted 0 ms 0 KB -