Submission #365814

# Submission time Handle Problem Language Result Execution time Memory
365814 2021-02-12T12:22:33 Z aihay Trampoline (info1cup20_trampoline) C++14
0 / 100
2000 ms 911276 KB
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef int in;
#define f first
#define s second
#define pb push_back
#define pp push
#define ceil(x) NEVER USE CEIL
#define sqrt(x) (int)(sqrt(x))

map<pair<int,int>,bool> gr;
bool fun(int x,int y,int x2,int y2){
    if(x==x2&&y<=y2){
        return 1;
    }
    if(x>x2||y>y2){
        return 0;
    }
    if(gr[{x,y}]){
        return max(fun(x+1,y,x2,y2),fun(x,y+1,x2,y2));
    }
    return fun(x,y+1,x2,y2);
}

in main()
{
	ios_base::sync_with_stdio(0);
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        int r,c,n,q;
        cin>>r>>c>>n;
        while(n--){
            int x,y;
            cin>>x>>y;
            gr[{x,y}]=1;
        }
        cin>>q;
        while(q--){
            int x,y,x2,y2;
            cin>>x>>y>>x2>>y2;
            cout<<(fun(x,y,x2,y2)?"Yes\n":"No\n");
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 1132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 15236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2156 ms 911276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2124 ms 422212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2117 ms 760812 KB Time limit exceeded
2 Halted 0 ms 0 KB -