Submission #690891

# Submission time Handle Problem Language Result Execution time Memory
690891 2023-01-30T15:02:52 Z TomitaMatei Trampoline (info1cup20_trampoline) C++14
62 / 100
2000 ms 2560 KB
#include <iostream>
#include <algorithm>
using namespace std;
struct pozitii
{
    int x,y;
}poz[200001];

bool ord (pozitii a, pozitii b)
{
    return  a.x<b.x || (a.x==b.x && a.y<b.y);
}

int n,k,i,m,t,x1,y1,x2,y2,mij,st,dr,ok;
int main()
{
    cin>>n>>m>>k;
    for (i=1; i<=k; i++)
    cin>>poz[i].x>>poz[i].y;

    sort (poz+1,poz+k+1,ord);

    cin>>t;
    while (t!=0)
    {
        t--;
        cin>>x1>>y1>>x2>>y2;

        st=1;
        dr=k;
        while (st<=dr)
        {
            mij=(st+dr)/2;
            if (poz[mij].x==x1) break;
            if (poz[mij].x>x1) dr=mij-1;
            else st=mij+1;
        }

        while (poz[mij-1].x==poz[mij].x) mij--;


        while (x2!=x1 && poz[mij].x<=x1)
        {
            if (poz[mij].x==x1 && poz[mij].y>=y1)
            {
                x1++;
                y1=poz[mij].y;
                if (y1>y2)
                    break;

            }

            mij++;
        }


        if (x2==x1 && y1<=y2)
            cout<<"Yes";
        else cout<<"No";
        cout<<'\n';

    }


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 340 KB 200 token(s): yes count is 70, no count is 130
3 Correct 4 ms 340 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 121 ms 1800 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 129 ms 2400 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 510 ms 2560 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 270 ms 2528 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Execution timed out 2076 ms 2268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 340 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 25 ms 644 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 19 ms 596 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 26 ms 592 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 34 ms 628 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 39 ms 636 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2101 ms 1864 KB Time limit exceeded
2 Halted 0 ms 0 KB -