답안 #138891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
138891 2019-07-30T19:57:45 Z jovan_b 벽 (IOI14_wall) C++17
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;

const int INF = 1000000000;

pair <int, int> seg[8000005];

void init(int node, int l, int r){
    seg[node].first = INF;
    if(l == r) return;
    int mid = (l+r)/2;
    init(node*2, l, mid);
    init(node*2+1, mid+1, r);
}

void update_children(int node, int l, int r){
    if(l == r) return;
    seg[node*2].first = min(seg[node*2].first, seg[node].first);
    seg[node*2].first = max(seg[node*2].first, seg[node].second);
    seg[node*2].second = max(seg[node*2].second, seg[node].second);
    seg[node*2].second = min(seg[node*2].second, seg[node].first);
    seg[node*2+1].first = min(seg[node*2+1].first, seg[node].first);
    seg[node*2+1].first = max(seg[node*2+1].first, seg[node].second);
    seg[node*2+1].second = max(seg[node*2+1].second, seg[node].second);
    seg[node*2+1].second = min(seg[node*2+1].second, seg[node].first);
    seg[node].first = INF;
    seg[node].second = 0;
}

void upd(int node, int l, int r, int tl, int tr, pair <int, int> val){
    update_children(node, l, r);
    if(l > tr || tl > r) return;
    if(tl <= l && r <= tr){
        seg[node].first = min(seg[node].first, val.first);
        seg[node].first = max(seg[node].first, val.second);
        seg[node].second = max(seg[node].second, val.second);
        seg[node].second = min(seg[node].second, val.first);
        return;
    }
    int mid = (l+r)/2;
    upd(node*2, l, mid, tl, tr, val);
    upd(node*2+1, mid+1, r, tl, tr, val);
}

int konacno[2000005];

void traverse(int node, int l, int r){
    update_children(node, l, r);
    if(l == r){
        konacno[l-1] = min(seg[node].first, seg[node].second);
        return;
    }
    int mid = (l+r)/2;
    traverse(node*2, l, mid);
    traverse(node*2+1, mid+1, r);
}

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    init(1, 1, n);
    for(int i=0; i<k; i++){
        if(op[i] == 2){
            upd(1, 1, n, left[i]+1, right[i]+1, {height[i], 0});
        }
        else{
            upd(1, 1, n, left[i]+1, right[i]+1, {INF, height[i]});
        }
    }
    traverse(1, 1, n);
    for(int i=0; i<n; i++){
        finalHeight[i] = konacno[i];
    }
    return;
}

Compilation message

wall.cpp:1:10: fatal error: grader.h: No such file or directory
 #include "grader.h"
          ^~~~~~~~~~
compilation terminated.