Submission #775567

# Submission time Handle Problem Language Result Execution time Memory
775567 2023-07-06T14:13:02 Z pulsatio Trampoline (info1cup20_trampoline) C++14
0 / 100
2000 ms 4844 KB
#include <bits/stdc++.h>

using namespace std;


int r,c,n,t;

vector<int> adj[200*200];


int id(int i,int j){
	return i*c + j;
}

bool dfs(int u,int x){
	 
	if(u == x) return true;
	for(int v:adj[u]){
		if(dfs(v,x))
			return true;
	}
	return false;
}

int main(){

	cin >> r >> c >> n;

	for(int i = 0; i < r; i++){
		for(int j = 0; j < c - 1; j++){
			adj[id(i,j)].push_back(id(i,j+1));
		}
	}
	int x,y,a,b;
	for(int i = 0; i < n; i++){
		cin >> x >> y;
		x--,y--;
		if(x < r-1)
			adj[id(x,y)].push_back(id(x+1,y));
	}

	cin >> t;

	while(t--){
		cin >> x >> y >> a >> b;
		
		if(dfs(id(x-1,y-1), id(a-1,b-1)))
			cout << "Yes\n";
		else
			cout << "No\n";

	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 2476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 4820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 4844 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 4820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 4820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -