Submission #412601

# Submission time Handle Problem Language Result Execution time Memory
412601 2021-05-27T07:05:57 Z cfalas Inside information (BOI21_servers) C++14
0 / 100
263 ms 640 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;
	a.insert(1);
	while(q--){
		char s;
		cin>>s;
		if(s=='S'){
			int x, y;
			cin>>x>>y;
			if(x==1) swap(x,y);
			assert(y==1);
			a.insert(x);
		}
		else if(s=='Q'){
			int x, y;
			cin>>x>>y;
			if(x==y) cout<<"yes\n";
			else if(a.count(x) && a.count(y)) cout<<"yes\n";
			else cout<<"no\n";
		}
		else{
			int x;
			cin>>x;
			if(a.count(x)) cout<<a.size()<<endl;
			else cout<<1<<endl;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 424 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 424 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 263 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 263 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 460 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 460 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 460 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 460 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 332 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -