#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 2505
#define fi first
#define se second
int r,c;
int v[lim][lim];
int dp[lim][lim];
inline int f(int x,int y,int tx,int ty){
if(x>r || y>c)return 0;
if(x==tx && y==ty)return 1;
if(~dp[x][y])return dp[x][y];
int cev=0;
if(v[x][y]){
cev+=f(x+1,y,tx,ty);
}
cev+=f(x,y+1,tx,ty);
return dp[x][y]=cev;
}
int32_t main(){
faster
int n;cin>>r>>c>>n;
FOR{
int x,y;cin>>x>>y;
v[x][y]=1;
}
int q;cin>>q;
while(q--){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
for(int i=1;i<=r;i++){
for(int j=1;j<=c;j++){
dp[i][j]=-1;
}
}
int tut=f(x1,y1,x2,y2);
if(tut)cout<<"Yes"<<'\n';
else cout<<"No"<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2648 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
11 ms |
2140 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
5 ms |
2744 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2064 ms |
100244 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |