답안 #523951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523951 2022-02-08T12:57:53 Z lucri Trampoline (info1cup20_trampoline) C++17
컴파일 오류
0 ms 0 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;
    for(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:26:12: error: expected ';' before ')' token
   26 |     for(q--)
      |            ^
      |            ;
trampoline.cpp:53:5: error: expected primary-expression before 'return'
   53 |     return 0;
      |     ^~~~~~
trampoline.cpp:52:6: error: expected ';' before 'return'
   52 |     }
      |      ^
      |      ;
   53 |     return 0;
      |     ~~~~~~
trampoline.cpp:53:5: error: expected primary-expression before 'return'
   53 |     return 0;
      |     ^~~~~~
trampoline.cpp:52:6: error: expected ')' before 'return'
   52 |     }
      |      ^
      |      )
   53 |     return 0;
      |     ~~~~~~
trampoline.cpp:26:8: note: to match this '('
   26 |     for(q--)
      |        ^