Submission #686374

# Submission time Handle Problem Language Result Execution time Memory
686374 2023-01-25T08:33:21 Z Cutebol Trampoline (info1cup20_trampoline) C++17
0 / 100
2000 ms 51208 KB
#include <bits/stdc++.h>
 
using namespace std;
 
void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define Xiao ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
#define int long long
#define itn int
#define endl "\n"
#define ff first
#define ss second

const int N = 2e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e6 ;

int n , k , r , c ;
int a[2505][2505] ;

bool dfs( int i , int j , int x , int y ){
	if ( i == x && j == y ) return true ;
	bool f , s ; 
	if ( a[i][j] && i < r ) f = dfs( i+1 , j , x , y ) ;
	if ( j < c )s = dfs( i , j+1 , x , y ) ;
	if ( f || s ) return true ;
	return false ;
}

void solve(){
	
	cin >> r >> c >> n ;
	for ( int i = 0 ; i < n ; i ++ ){
		int x , y ;
		cin >> x >> y ;
		a[x][y] = 1 ; 
	}
	int t ;
	cin >> t ;
	while ( t -- ){
		int x1 , y1 , x2 , y2 ;
		cin >> x1 >> y1 >> x2 >> y2 ;
		if ( dfs( x1 , y1 , x2 , y2 ) ) cout << "Yes\n" ;
		else cout << "No\n" ;
	}
}
 
signed main(){
//  fopn("blocks") ;
//   	Xiao ;
    int tt = 1 ;
//    	cin >> t ;
    while ( tt -- ) solve() ; 
}

Compilation message

trampoline.cpp: In function 'void fopn(std::string)':
trampoline.cpp:5:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:5:72: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp: In function 'bool dfs(long long int, long long int, long long int, long long int)':
trampoline.cpp:25:9: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |  if ( f || s ) return true ;
      |       ~~^~~~
trampoline.cpp:25:9: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Execution timed out 2067 ms 1364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2081 ms 51208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -