Submission #657576

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

void solve() {

	int n,q; cin>>n>>q;
	vector<bitset<120000>> a(n);
	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 19 ms 1488 KB Output is correct
2 Correct 177 ms 59288 KB Output is correct
3 Correct 186 ms 59400 KB Output is correct
4 Correct 185 ms 59352 KB Output is correct
5 Correct 178 ms 59280 KB Output is correct
6 Correct 187 ms 59412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1488 KB Output is correct
2 Correct 177 ms 59288 KB Output is correct
3 Correct 186 ms 59400 KB Output is correct
4 Correct 185 ms 59352 KB Output is correct
5 Correct 178 ms 59280 KB Output is correct
6 Correct 187 ms 59412 KB Output is correct
7 Correct 50 ms 1340 KB Output is correct
8 Correct 449 ms 59312 KB Output is correct
9 Correct 422 ms 59520 KB Output is correct
10 Correct 453 ms 59276 KB Output is correct
11 Correct 444 ms 59340 KB Output is correct
12 Correct 441 ms 59392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1364 KB Output is correct
2 Runtime error 188 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1364 KB Output is correct
2 Runtime error 188 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1364 KB Output is correct
2 Runtime error 185 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1364 KB Output is correct
2 Runtime error 185 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1312 KB Output is correct
2 Runtime error 187 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1312 KB Output is correct
2 Runtime error 187 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1456 KB Output is correct
2 Runtime error 195 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1456 KB Output is correct
2 Runtime error 195 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1332 KB Output is correct
2 Correct 195 ms 59340 KB Output is correct
3 Correct 217 ms 59440 KB Output is correct
4 Correct 204 ms 59340 KB Output is correct
5 Correct 191 ms 59340 KB Output is correct
6 Correct 210 ms 59456 KB Output is correct
7 Correct 20 ms 1352 KB Output is correct
8 Runtime error 194 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1332 KB Output is correct
2 Correct 195 ms 59340 KB Output is correct
3 Correct 217 ms 59440 KB Output is correct
4 Correct 204 ms 59340 KB Output is correct
5 Correct 191 ms 59340 KB Output is correct
6 Correct 210 ms 59456 KB Output is correct
7 Correct 20 ms 1352 KB Output is correct
8 Runtime error 194 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -