Submission #914737

# Submission time Handle Problem Language Result Execution time Memory
914737 2024-01-22T15:44:23 Z NValchanov Trampoline (info1cup20_trampoline) C++17
43 / 100
36 ms 10620 KB
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

typedef long long ll;

const ll MAXN=2e5+10;
const ll MAXR=1e9+10;
const ll MAXC=1e9+10;
const ll MAXT=2e5+10;

ll r,c,n,t;
bool a[3000][3000];

bool check(ll x1,ll y1,ll x2,ll y2)
{
    return x1<=x2&&y1<=y2;
}

void query(ll x1,ll y1,ll x2,ll y2)
{
    if(!check(x1,y1,x2,y2))
    {
        cout<<"No"<<endl;
        return;
    }
    ll x=x1,y=y1;
    while(x<=r&&y<=c)
    {
        if(x==x2&&y==y2)
        {
            cout<<"Yes"<<endl;
            return;
        }
        if(a[x][y]&&x<x2)
            x++;
        else
            y++;
    }
    cout<<"No"<<endl;
}

void read()
{
    cin>>r>>c>>n;
    for(ll i=1;i<=n;i++)
    {
        ll x,y;
        cin>>x>>y;
        a[x][y]=true;
    }
    cin>>t;
    for(ll i=1;i<=t;i++)
    {
        ll x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2;
        query(x1,y1,x2,y2);
    }
}

int main()
{
    #ifdef ONLINE_JUDGE
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

    read();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB 200 token(s): yes count is 21, no count is 179
2 Correct 2 ms 2652 KB 200 token(s): yes count is 70, no count is 130
3 Correct 2 ms 2652 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 33 ms 10588 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 34 ms 10588 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 25 ms 4180 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 36 ms 10620 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -