답안 #481785

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
481785 2021-10-21T23:00:38 Z Yazan_Alattar Trampoline (info1cup20_trampoline) C++14
11 / 100
241 ms 37696 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <utility>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 200007;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

set < pair < pair < int,int >, int > > s;
pair <int,int> a[M];
int r, c, n, nxt[M][22];

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> r >> c >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i].F >> a[i].S;
    sort(a + 1, a + n + 1);
    for(int i = 1; i <= n; ++i){
        while(s.size()){
            pair < pair <int,int>, int > p = *s.begin();
            if(p.F.F + 1 < a[i].F) s.erase(s.begin());
            else if(p.F.F == a[i].F - 1 && p.F.S <= a[i].S){
                nxt[p.S][0] = i;
                s.erase(s.begin());
            }
            else break;
        }
        s.insert({a[i], i});
    }
    for(int j = 1; j <= 20; ++j)
        for(int i = 1; i <= n; ++i)
            nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
    int q;
    cin >> q;
    while(q--){
        pair <int,int> st, en;
        cin >> st.F >> st.S >> en.F >> en.S;
//        if(st.F == en.F){
//             if(st.S <= en.S) cout << "Yes\n";
//             else cout << "No\n";
//             continue;
//        }
        int x = lower_bound(a + 1, a + n + 1, st) - a;
        if(x <= n && a[x].F == st.F && a[x].S <= en.S) cout << "Yes\n";
        else cout << "No\n";
//        if(x > n || a[x].F > st.F){
//            cout << "No\n";
//            continue;
//        }
//        for(int i = 20; i >= 0; --i)
//            if(nxt[x][i] && a[nxt[x][i]].F <= en.F) x = nxt[x][i];
//        if((a[x].F == en.F || a[x].F + 1 == en.F) && a[x].S <= en.S) cout << "Yes\n";
//        else cout << "No\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1100 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 19004 KB expected NO, found YES [1st token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 219 ms 27620 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 237 ms 37696 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 241 ms 31940 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 219 ms 31172 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 225 ms 31288 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 219 ms 31180 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 844 KB expected NO, found YES [17th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 218 ms 19908 KB expected NO, found YES [23rd token]
2 Halted 0 ms 0 KB -