Submission #693349

# Submission time Handle Problem Language Result Execution time Memory
693349 2023-02-02T21:39:30 Z Ahmed_Solyman Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 17208 KB
#include <bits/stdc++.h>
#include <ext/rope>
 
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define sz size()
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
    return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
    cout<<(x?"YES":"NO")<<endl;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast
    int r,c,n;
    cin>>r>>c>>n;
    map<int,set<int>>arr;
    for(int i=0;i<n;i++){
    	int x,y;
    	cin>>x>>y;
    	arr[x].insert(y);
    }
    int q;cin>>q;
    while(q--){
    	int x,y,a,b;
    	cin>>x>>y>>a>>b;
    	if(a<x ||  b<y || a-x>n){
    		cout<<"No"<<endl;
    	}
    	else{
    		int p=y;
    		bool valid=1;
    		for(int i=x;i<a;i++){
    			if(!arr[i].sz){
    				valid=0;
    				break;
    			}
    			auto h=arr[i].lb(p);
    			if(h==arr[i].end()){
    				valid=0;
    				break;
    			}
    			int j=*h;
    			if(j>b){
    				valid=0;
    				break;
    			}
    			else{
    				p=j;
    			}
    		}
    		cout<<(valid?"Yes":"No")<<endl;
    	}
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 852 KB 200 token(s): yes count is 21, no count is 179
2 Correct 4 ms 724 KB 200 token(s): yes count is 70, no count is 130
3 Correct 3 ms 596 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 173 ms 9936 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 140 ms 9932 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 444 ms 9752 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 525 ms 9944 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 282 ms 10332 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 252 ms 10404 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 297 ms 10508 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 271 ms 10720 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 316 ms 10612 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 342 ms 16784 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 12 ms 468 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 6 ms 980 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 5 ms 468 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 280 ms 712 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 4 ms 468 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 17208 KB Time limit exceeded
2 Halted 0 ms 0 KB -