답안 #736275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
736275 2023-05-05T11:40:14 Z ksu2009en Event Hopping (BOI22_events) C++14
0 / 100
283 ms 2528 KB
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>

using namespace std;
typedef int ll;

#define endl '\n'

struct one{
    ll first, second, ind;
};
 
bool cmp(one &p1, one &p2){
    if(p1.first <= p2.first && p2.second <= p1.second)
        return false;
    if(p2.first <= p1.first && p1.second <= p2.second)
        return true;
    
    if(p1.first == p2.first)
        return p1.second < p2.second;
    return p1.first < p2.first;
}

bool cmp2(one &p1, one &p2){
    if(p1.first == p2.first)
        return p1.second < p2.second;
    return p1.first < p2.first;
}
 
void compress(vector<one> &a){
    vector<ll>b;
    for(auto i: a){
        b.push_back(i.first);
        b.push_back(i.second);
    }
    
    sort(b.begin(), b.end());
    b.resize(unique(b.begin(), b.end()) - b.begin());
    
    ll step = 1;
    map<ll, ll> mp;
    for(auto i: b)
        mp[i] = step++;
    
    for(auto &i: a){
        i.first = mp[i.first];
        i.second = mp[i.second];
    }
}


ll pref[2 * 5007];
vector<one>a;

int main(){
    ll n, q;
    cin >> n >> q;
    
    a.resize(n);
    for(int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
        a[i].ind = i;
    }
    
 //   compress(a);
   // sort(a.begin(), a.end(), cmp);
    
    
    while(q--){
        ll l, r;
        cin >> l >> r;
        
        l--, r--;
        
        if(a[r].first <= a[l].second && a[l].second <= a[r].second)
            cout << 1 << endl;
        else
            cout << "impossible" << endl;
    }
     
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 283 ms 2528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -