Submission #523952

# Submission time Handle Problem Language Result Execution time Memory
523952 2022-02-08T12:58:29 Z lucri Trampoline (info1cup20_trampoline) C++17
19 / 100
2000 ms 2588 KB
#include <iostream>
#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);
}
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;
            while(tr[poz].first<l||tr[poz].first==l&&tr[poz].second<c)
                ++poz;
        }
        if(c<=ye)
            cout<<"Yes"<<'\n';
        else
            cout<<"No"<<'\n';
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'int cb(int, int)':
trampoline.cpp:12:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   12 |     if(tr[m].first<xb||tr[m].first==xb&&tr[m].second<=yb)
      |                        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
trampoline.cpp: In function 'int main()':
trampoline.cpp:45:52: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   45 |             while(tr[poz].first<l||tr[poz].first==l&&tr[poz].second<c)
      |                                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB 200 token(s): yes count is 21, no count is 179
2 Incorrect 5 ms 304 KB expected YES, found NO [10th token]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 126 ms 1732 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 125 ms 1796 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 660 ms 1900 KB 4000 token(s): yes count is 4000, no count is 0
4 Incorrect 318 ms 1756 KB expected YES, found NO [993rd token]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 713 ms 2588 KB expected YES, found NO [3353rd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 332 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 29 ms 588 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 18 ms 344 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 23 ms 332 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 41 ms 352 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 23 ms 344 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2077 ms 2112 KB Time limit exceeded
2 Halted 0 ms 0 KB -