Submission #523956

# Submission time Handle Problem Language Result Execution time Memory
523956 2022-02-08T13:10:31 Z lucri Trampoline (info1cup20_trampoline) C++17
11 / 100
766 ms 3656 KB
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int n,m,k,q;
pair<int,int>tr[200010];
int xb,yb,xe,ye;
int cb(int b,int e)
{
    if(b>e)
        return b;
    int m=(b+e)/2;
    if(tr[m].first<xb||tr[m].first==xb&&tr[m].second<yb)
        return cb(m+1,e);
    return cb(b,m-1);
}
ifstream in("test.in");
ofstream out("test.out");
int main()
{
    cin>>n>>m>>k;
    for(int i=1;i<=k;++i)
        cin>>tr[i].first>>tr[i].second;
    sort(tr+1,tr+k+1);
    tr[k+1]={1111111111,1111111111};
    cin>>q;
    while(q--)
    {
        cin>>xb>>yb>>xe>>ye;
        int poz=cb(1,k);
        int l=xb,c=yb;
        while(l!=xe)
        {
            if(tr[poz].first==l)
            {
                ++l;
                c=tr[poz].second;
            }
            else
            {
                c=1111111111;
                break;
            }
            if(l==xe||c>ye)
                break;
            xb=l;
            yb=c;
            cb(poz+1,k);
        }
        if(c<=ye)
            cout<<"Yes"<<'\n';
        else
            cout<<"No"<<'\n';
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'int cb(int, int)':
trampoline.cpp:13:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |     if(tr[m].first<xb||tr[m].first==xb&&tr[m].second<yb)
      |                        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 1832 KB expected YES, found NO [3rd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 746 ms 2724 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 730 ms 2552 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 727 ms 2480 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 741 ms 2536 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 766 ms 2500 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 734 ms 2616 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 332 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 759 ms 3656 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -