답안 #817446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
817446 2023-08-09T12:36:43 Z MohamedAhmed04 Inside information (BOI21_servers) C++14
5 / 100
108 ms 112796 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 4000 + 10 ;

int n , q ;

vector< vector<int> >adj(MAX) ;
vector<int>v[MAX] ;

int cnt[MAX] , mark[MAX][MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>q ;
	for(int i = 1 ; i <= n ; ++i)
		v[i] = {i} , cnt[i] = 1 , mark[i][i] = 1 ;
	for(int i = 0 ; i < n+q-1 ; ++i)
	{
		char c ;
		cin>>c ;
		if(c == 'S')
		{
			int x , y ;
			cin>>x>>y ;
			vector<int>v2 = v[x] ;
			for(auto &j : v[y])
				v[x].push_back(j) , mark[x][j] = 1 , cnt[j]++ ;
			for(auto &j : v2)
				v[y].push_back(j) , mark[y][j] = 1 , cnt[j]++ ;

		}
		else if(c == 'Q')
		{
			int x , y ;
			cin>>x>>y ;
			if(mark[x][y])
				cout<<"yes\n" ;
			else
				cout<<"no\n" ;
		}
		else if(c == 'C')
		{
			int x ;
			cin>>x ;
			cout<<cnt[x]<<"\n" ;
		}
	}
	return 0 ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1876 KB Output is correct
2 Correct 52 ms 49404 KB Output is correct
3 Correct 67 ms 70384 KB Output is correct
4 Correct 54 ms 49008 KB Output is correct
5 Correct 33 ms 18508 KB Output is correct
6 Correct 105 ms 112796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1876 KB Output is correct
2 Correct 52 ms 49404 KB Output is correct
3 Correct 67 ms 70384 KB Output is correct
4 Correct 54 ms 49008 KB Output is correct
5 Correct 33 ms 18508 KB Output is correct
6 Correct 105 ms 112796 KB Output is correct
7 Correct 14 ms 1908 KB Output is correct
8 Correct 50 ms 48968 KB Output is correct
9 Correct 56 ms 72128 KB Output is correct
10 Correct 50 ms 48700 KB Output is correct
11 Correct 32 ms 18252 KB Output is correct
12 Correct 97 ms 112480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2004 KB Output is correct
2 Runtime error 45 ms 34048 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2004 KB Output is correct
2 Runtime error 45 ms 34048 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1856 KB Output is correct
2 Runtime error 41 ms 33928 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1856 KB Output is correct
2 Runtime error 41 ms 33928 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1872 KB Output is correct
2 Runtime error 47 ms 33888 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1872 KB Output is correct
2 Runtime error 47 ms 33888 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1920 KB Output is correct
2 Runtime error 41 ms 33872 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 1920 KB Output is correct
2 Runtime error 41 ms 33872 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1960 KB Output is correct
2 Correct 70 ms 49440 KB Output is correct
3 Correct 59 ms 70432 KB Output is correct
4 Correct 56 ms 49044 KB Output is correct
5 Correct 33 ms 18548 KB Output is correct
6 Correct 108 ms 112732 KB Output is correct
7 Correct 15 ms 1996 KB Output is correct
8 Runtime error 41 ms 33912 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1960 KB Output is correct
2 Correct 70 ms 49440 KB Output is correct
3 Correct 59 ms 70432 KB Output is correct
4 Correct 56 ms 49044 KB Output is correct
5 Correct 33 ms 18548 KB Output is correct
6 Correct 108 ms 112732 KB Output is correct
7 Correct 15 ms 1996 KB Output is correct
8 Runtime error 41 ms 33912 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -