답안 #995493

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995493 2024-06-09T07:22:58 Z hirayuu_oj 통행료 (IOI18_highway) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
ll LINF=(1LL<<61)-1;
ll MINF=1LL<<40;
int INF=INT_MAX>>1;

template<class S>
void out_vector(vector<S> v){
    for(S i:v)cerr<<i<<" ";
    cerr<<"\n";
}
#include "meetings.h"

struct SegmentTree{
    
    using T=array<int,4>;
    T op(T x,T y){
        T ret;
        ret[0]=max({x[0],y[0],x[2]+y[1]});
        ret[1]=x[1];
        if(x[1]==x[3])ret[1]+=y[1];
        ret[2]=y[2];
        if(y[2]==y[3])ret[2]+=x[2];
        ret[3]=x[3]+y[3];
        return ret;
    }
    T e(){
        return {0,0,0,0};
    }

    vector<T> val;
    int size;
    SegmentTree(int sz){
        size=sz;
        val.resize(sz*2,e());
    }
    void set(int pos,T v){
        pos+=size;
        val[pos]=v;
        while(pos>1){
            pos>>=1;
            val[pos]=op(val[pos*2],val[pos*2+1]);
        }
    }
    T get(int lf,int ri){
        lf+=size;
        ri+=size;
        T rel=e();
        T rer=e();
        while(lf<ri){
            if(lf&1){
                rel=op(rel,val[lf]);
                lf++;
            }
            if(ri&1){
                ri--;
                rer=op(val[ri],rer);
            }
            lf/=2;
            ri/=2;
        }
        return op(rel,rer);
    }
};
//max,lf,ri,sz
using T=array<int,4>;
T op(T x,T y){
    T ret;
    ret[0]=max({x[0],y[0],x[2]+y[1]});
    ret[1]=x[1];
    if(x[1]==x[3])ret[1]+=y[1];
    ret[2]=y[2];
    if(y[2]==y[3])ret[2]+=x[2];
    ret[3]=x[3]+y[3];
    return ret;
}
T e(){
    return {0,0,0,0};
}
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
                                     std::vector<int> R) {
    int Q = L.size();
    int N=H.size();
    SegmentTree seg(N);
    vector<ll> C(Q);
    rep(i,N){
        if(H[i]==1){
            seg.set(i,{1,1,1,1});
        }
        else{
            seg.set(i,{0,0,0,1});
        }
    }
    rep(i,Q){
        C[i]=(R[i]+1-L[i])*2-seg.get(L[i],R[i]+1)[0];
    }
    return C;
}

Compilation message

highway.cpp:16:10: fatal error: meetings.h: No such file or directory
   16 | #include "meetings.h"
      |          ^~~~~~~~~~~~
compilation terminated.