답안 #522740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522740 2022-02-05T15:08:28 Z alexdumitru Trampoline (info1cup20_trampoline) C++14
0 / 100
103 ms 29236 KB
#include <bits/stdc++.h>

using namespace std;
pair<int,int> a[200005];
int n,i,t,j,sx,sy,fx,fy,r,c,lift[200005][35];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>r>>c>>n;
    for(i=1;i<=n;i++)
        cin>>a[i].first>>a[i].second;
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++)
    {
        /*int st=i+1;
        int dr=n;
        int poz=0;
        while(st<=dr)
        {
            int m=(st+dr)/2;
            if(a[m].first<a[i].first+1)
                st=m+1;
            else if(a[m].first>a[i].first+1)
                dr=m-1;
            else {
                if(a[m].second>=a[i].second)
                {
                    poz=m;
                    dr=m-1;
                }
                else st=m-1;
            }
        }
        lift[i][0]=poz;*/
    }
    for(j=1;j<=20;j++)
        for(i=1;i<=n;i++)
            lift[i][j]=lift[lift[i][j-1]][j-1];
            return 0;
    cin>>t;
    while(t--)
    {
        cin>>sx>>sy>>fx>>fy;
        if(sx>fx)
        {
            cout<<"No\n";
        }
        else if(sx==fx)
        {
            if(sy<=fy)
                cout<<"Yes\n";
            else cout<<"No\n";
        }
        else {
            if(sy>fy)
            {
                cout<<"No\n";
                continue;
            }
            int st=1;
            int dr=n;
            int poz=0;
            while(st<=dr)
            {
                int m=(st+dr)/2;
                if(a[m].first<sx)
                    st=m+1;
                else if(a[m].first>sx)
                    dr=m-1;
                else {
                    if(a[m].second<sy)
                        st=m+1;
                    else {
                        dr=m-1;
                        poz=m;
                    }
                }
            }
            if(!poz)
            {
                cout<<"No\n";
                continue;
            }
            /*int di=fx-sx-1;
            for(j=0;j<=30;j++)
                if(di&(1<<j))
                    poz=lift[poz][j];
            if(poz&&a[poz].second<=fy)
                cout<<"Yes\n";
            else cout<<"No\n";*/
        }
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:38:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   38 |         for(i=1;i<=n;i++)
      |         ^~~
trampoline.cpp:40:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   40 |             return 0;
      |             ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1484 KB Answer contains longer sequence [length = 200], but output contains 0 elements
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 92 ms 29208 KB Answer contains longer sequence [length = 4000], but output contains 0 elements
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 103 ms 29148 KB Answer contains longer sequence [length = 200000], but output contains 0 elements
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 976 KB Answer contains longer sequence [length = 5000], but output contains 0 elements
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 99 ms 29236 KB Answer contains longer sequence [length = 200000], but output contains 0 elements
2 Halted 0 ms 0 KB -