| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 172749 | arnold518 | Matryoshka (JOI16_matryoshka) | C++14 | 2 ms | 504 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2e5;
struct Point
{
    int x, y;
};
int N, Q;
Point A[MAXN+10];
int main()
{
    int i, j;
    scanf("%d%d", &N, &Q);
    for(i=1; i<=N; i++) scanf("%d%d", &A[i].x, &A[i].y);
    sort(A+1, A+N+1, [&](const Point &p, const Point &q)
         {
             if(p.x!=q.x) return p.x<q.x;
             return p.y<q.y;
         });
    vector<Point> V;
    multimap<int, int> S;
    for(i=1; i<=N; )
    {
        for(j=i; j<=N && A[j].x==A[i].x; j++)
        {
            auto it = S.lower_bound(A[j].y);
            if(it==S.begin()) continue;
            it--;
            V.push_back({it->second, A[j].y});
            S.erase(it);
        }
        for(j=i; j<=N && A[j].x==A[i].x; j++)
        {
            S.insert(pii(A[j].y, A[j].x));
        }
        i=j;
    }
    while(Q--)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        int ans=0;
        for(j=1; j<=N; j++) if(A[j].x>=a && A[j].y<=b) ans++;
        for(j=0; j<V.size(); j++) if(V[j].x>=a && V[j].y<=b) ans--;
        printf("%d\n", ans);
    }
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
