답안 #365973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
365973 2021-02-12T15:46:02 Z soba Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 13676 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
vector<ll>v[200001];
int main()
{
    ll r , c , n , x , y , a, b, t;
    cin >> r>> c >> n ;
    //cout << r << " " << c << " " << n << "\n";
    map<ll,ll>mp;
    //cout << "haha\n";
    ll cnt=1;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> x>> y ;
        if(!mp[x])mp[x]=cnt++;
        v[mp[x]].push_back(y);
    }
    for(int i =1 ;i < cnt ; i++)
    {
        sort(v[i].begin() , v[i].end());
    }
    cin >> t;
    while(t--)
    {
        cin>> x >> y >> a >> b ;
        if(a-x > cnt-1)
        {
            cout << "No\n";
            continue;
        }
        if(x==a)
        {
            if(y<=b)
            {
                cout << "Yes\n";
            }
            else cout << "No\n";
            continue;
        }
        int j=y;
        int impos=1;
        for(int i = x ; i<a ; i++)
        {
            if(mp[i]==0)
            {
                impos=1;
                break;
            }
            vector<ll>::iterator it = lower_bound(v[mp[i]].begin() , v[mp[i]].end() , j);
            if(it==v[mp[i]].end())
            {
            	j=c+1;
            }
            else j=*it;
            //cout << j << "\n";
            if(j>b)
            {
                impos=1;
                break;
            }
            if(i==a-1)
            {
                impos=0;
            }
        }
        if(impos)
        {
            cout << "No\n";
        }
        else cout << "Yes\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 5100 KB 200 token(s): yes count is 21, no count is 179
2 Correct 12 ms 5228 KB 200 token(s): yes count is 70, no count is 130
3 Correct 11 ms 5100 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 200 ms 8044 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 204 ms 8156 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 421 ms 7404 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 659 ms 8172 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 1036 ms 8316 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 1051 ms 7696 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 1071 ms 7960 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 1154 ms 8548 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 1139 ms 8540 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 1381 ms 13384 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 5100 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 37 ms 5228 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 32 ms 5484 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 29 ms 5100 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 522 ms 5372 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 30 ms 5228 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2084 ms 13676 KB Time limit exceeded
2 Halted 0 ms 0 KB -