Submission #412592

# Submission time Handle Problem Language Result Execution time Memory
412592 2021-05-27T06:48:36 Z cfalas Inside information (BOI21_servers) C++14
2.5 / 100
3375 ms 524292 KB
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;

#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)

int t, n;
vi a, b;

int main(){
	int q;
	cin>>n>>q;
	q+=n-1;
	set<int> a[n+1];
	FOR(i,n+1){
		a[i].insert(i);
	}
	while(q--){
		char s;
		cin>>s;
		if(s=='S'){
			int x, y;
			cin>>x>>y;
			FOA(v, a[x]) a[y].insert(v);
			FOA(v, a[y]) a[x].insert(v);
		}
		else if(s=='Q'){
			int x, y;
			cin>>x>>y;
			if(a[x].count(y)) cout<<"yes\n";
			else cout<<"no\n";
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 248 ms 1324 KB Output is correct
2 Correct 292 ms 3468 KB Output is correct
3 Correct 540 ms 48964 KB Output is correct
4 Correct 287 ms 3188 KB Output is correct
5 Correct 298 ms 3012 KB Output is correct
6 Correct 2503 ms 378224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 248 ms 1324 KB Output is correct
2 Correct 292 ms 3468 KB Output is correct
3 Correct 540 ms 48964 KB Output is correct
4 Correct 287 ms 3188 KB Output is correct
5 Correct 298 ms 3012 KB Output is correct
6 Correct 2503 ms 378224 KB Output is correct
7 Incorrect 242 ms 680 KB Extra information in the output file
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 256 ms 1296 KB Output is correct
2 Runtime error 2681 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 256 ms 1296 KB Output is correct
2 Runtime error 2681 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 253 ms 1292 KB Output is correct
2 Correct 515 ms 34652 KB Output is correct
3 Correct 535 ms 34596 KB Output is correct
4 Runtime error 1650 ms 524292 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Correct 253 ms 1292 KB Output is correct
2 Correct 515 ms 34652 KB Output is correct
3 Correct 535 ms 34596 KB Output is correct
4 Runtime error 1650 ms 524292 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Correct 268 ms 1188 KB Output is correct
2 Runtime error 3375 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 1188 KB Output is correct
2 Runtime error 3375 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 1304 KB Output is correct
2 Correct 531 ms 34552 KB Output is correct
3 Correct 521 ms 34656 KB Output is correct
4 Runtime error 1615 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 1304 KB Output is correct
2 Correct 531 ms 34552 KB Output is correct
3 Correct 521 ms 34656 KB Output is correct
4 Runtime error 1615 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 262 ms 1252 KB Output is correct
2 Correct 289 ms 3492 KB Output is correct
3 Correct 603 ms 48912 KB Output is correct
4 Correct 289 ms 3120 KB Output is correct
5 Correct 288 ms 2976 KB Output is correct
6 Correct 2498 ms 378272 KB Output is correct
7 Correct 270 ms 1576 KB Output is correct
8 Runtime error 2722 ms 524292 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 262 ms 1252 KB Output is correct
2 Correct 289 ms 3492 KB Output is correct
3 Correct 603 ms 48912 KB Output is correct
4 Correct 289 ms 3120 KB Output is correct
5 Correct 288 ms 2976 KB Output is correct
6 Correct 2498 ms 378272 KB Output is correct
7 Correct 270 ms 1576 KB Output is correct
8 Runtime error 2722 ms 524292 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -