Submission #657577

# Submission time Handle Problem Language Result Execution time Memory
657577 2022-11-10T09:55:29 Z TimDee Inside information (BOI21_servers) C++17
5 / 100
3500 ms 513420 KB
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for (int i=0; i<n; ++i)

bitset<120000> a[120002];

void solve() {

	int n,q; cin>>n>>q;
	forn(i,n) a[i].set(i);

	forn(Q,n-1+q) {
		char c;
		cin>>c;
		if (c=='S') {

			int u,v; cin>>u>>v; --u,--v;
			forn(i,n) {
				if (a[i][u]) a[i].set(v);
				else if (a[i][v]) a[i].set(u);
			}

		} else if (c=='Q') {

			int u,x; cin>>u>>x; --u, --x;
			cout << (a[x][u]?"yes\n":"no\n");

		} else {
			int x; cin>>x; --x;
			cout<<a[x].count()<<'\n';
		}
	}

}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 17 ms 852 KB Output is correct
2 Correct 182 ms 18192 KB Output is correct
3 Correct 203 ms 18776 KB Output is correct
4 Correct 219 ms 18140 KB Output is correct
5 Correct 173 ms 16824 KB Output is correct
6 Correct 197 ms 18764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 852 KB Output is correct
2 Correct 182 ms 18192 KB Output is correct
3 Correct 203 ms 18776 KB Output is correct
4 Correct 219 ms 18140 KB Output is correct
5 Correct 173 ms 16824 KB Output is correct
6 Correct 197 ms 18764 KB Output is correct
7 Correct 51 ms 840 KB Output is correct
8 Correct 448 ms 17912 KB Output is correct
9 Correct 453 ms 18656 KB Output is correct
10 Correct 439 ms 17880 KB Output is correct
11 Correct 454 ms 16684 KB Output is correct
12 Correct 474 ms 18932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Execution timed out 3617 ms 513420 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Execution timed out 3617 ms 513420 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 836 KB Output is correct
2 Execution timed out 3592 ms 483896 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 836 KB Output is correct
2 Execution timed out 3592 ms 483896 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 852 KB Output is correct
2 Execution timed out 3593 ms 495880 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 852 KB Output is correct
2 Execution timed out 3593 ms 495880 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Execution timed out 3599 ms 483784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Execution timed out 3599 ms 483784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Correct 178 ms 18100 KB Output is correct
3 Correct 186 ms 18764 KB Output is correct
4 Correct 211 ms 17996 KB Output is correct
5 Correct 175 ms 16688 KB Output is correct
6 Correct 189 ms 18684 KB Output is correct
7 Correct 18 ms 852 KB Output is correct
8 Execution timed out 3580 ms 512736 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 852 KB Output is correct
2 Correct 178 ms 18100 KB Output is correct
3 Correct 186 ms 18764 KB Output is correct
4 Correct 211 ms 17996 KB Output is correct
5 Correct 175 ms 16688 KB Output is correct
6 Correct 189 ms 18684 KB Output is correct
7 Correct 18 ms 852 KB Output is correct
8 Execution timed out 3580 ms 512736 KB Time limit exceeded
9 Halted 0 ms 0 KB -