답안 #370657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
370657 2021-02-24T12:16:22 Z TLP39 Sails (IOI07_sails) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "crectlib.h"
using namespace std;

int main()
{
    long long int n;
    scanf("%lld",&n);
    pair<long long int,long long int> kh[n];
    long long int k,h;
    for(long long int i=0;i<n;i++)
    {
        scanf("%lld %lld",&k,&h);
        kh[i]={k,h};
    }
    sort(kh,kh+n);
    map<long long int,long long int> change;
    long long int ma=0,mi=100001;
    auto it=change.begin();
    long long int ch,hol1;
    for(long long int i=0;i<n;i++)
    {
        k=kh[i].first;
        h=kh[i].second;
        if(k>ma && mi)
        {
            change[ma]=mi;
            mi=0;
        }
        ma=k;
        it=change.upper_bound(k-h);
        it--;
        if((*it).first==k-h)
        {
            (*it).second--;
            if((*it).second==0) change.erase(it);
            mi++;
        }
        else
        {
            ch=0;
            hol1=(*it).first;
            it++;
            if(it==change.end()) ch=1;
            if(ch)
            {
                change[h+hol1]=1;
                change[hol1]--;
                if(!change[hol1]) change.erase(hol1);
            }
            else
            {
                mi++;
                change[hol1+((*it).first)-k+h]=1;
                change[hol1]--;
                if(!change[hol1]) change.erase(hol1);
                change[(*it).first]--;
                if(!change[(*it).first]) change.erase(it);
            }
        }
    }
    long long int val=100001;
    long long int ans=0;
    for(long long int i=0;i<ma;i++)
    {
        val-=change[i];
        printf("X %lld\n",val);
        ans+=val*(val-1)/2;
    }
    printf("%lld",ans);
}

Compilation message

sails.cpp:2:10: fatal error: crectlib.h: No such file or directory
    2 | #include "crectlib.h"
      |          ^~~~~~~~~~~~
compilation terminated.