# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
295067 |
2020-09-09T13:04:01 Z |
arayi |
벽 (IOI14_wall) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "grader.h"
#define MP make_pair
#define ad push_back
#define fr first
#define sc second
using namespace std;
const int N = 2e6 + 30;
const int n1 = 1e5;
int nn;
vector <pair<int, int> > fp[N], fp1[N], ff[N], ff1[N];
bool col[N];
priority_queue <int> h[n1 + 20], h1[n1 + 20];
int t1[4 * n1];
void upd1(int q, int l = 0, int r = n1, int nd = 1)
{
if(q > r || q < l) return;
if(l == r)
{
if(h1[l].empty()) t1[nd] = 0;
else t1[nd] = h1[l].top();
return;
}
int mid = (l + r) / 2;
upd1(q, l, mid, nd * 2);
upd1(q, mid + 1, r, nd * 2 + 1);
t1[nd] = max(t1[nd * 2], t1[nd * 2 + 1]);
}
int t[4 * n1];
void upd(int q, int l = 0, int r = n1, int nd = 1)
{
if(q > r || q < l) return;
if(l == r)
{
if(h[l].empty()) t[nd] = 0;
else t[nd] = h[l].top();
return;
}
int mid = (l + r) / 2;
upd(q, l, mid, nd * 2);
upd(q, mid + 1, r, nd * 2 + 1);
t[nd] = max(t[nd * 2], t[nd * 2 + 1]);
}
int qry(int l = 0, int r = n1, int nd = 1, int a = 0, int b = 0)
{
if(l == r) return l;
int mid = (l + r) / 2;
if(max(a, t1[nd * 2]) < max(b, t[nd * 2 + 1])) return qry(mid + 1, r, nd * 2 + 1, max(a, t1[nd * 2]), b);
else return qry(l, mid, nd * 2, a, max(b, t[nd * 2 + 1]));
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
nn = n;
for (int i = 0; i < k; i++)
{
if(op[i] == 1) fp[left[i]].ad(MP(height[i], i + 1)), ff[right[i] + 1].ad(MP(height[i], i + 1));
else fp1[left[i]].ad(MP(height[i], i + 1)), ff1[right[i] + 1].ad(MP(height[i], i + 1));
}
for (int i = 0; i < nn; i++)
{
for(auto p : fp[i])
{
h[p.fr].push(p.sc);
upd(p.fr);
}
for(auto p : fp1[i])
{
h1[p.fr].push(p.sc);
upd1(p.fr);
}
for(auto p : ff[i])
{
col[p.sc] = 1;
while(!h[p.fr].empty() && col[h[p.fr].top()]) h[p.fr].pop();
upd(p.fr);
}
for(auto p : ff1[i])
{
col[p.sc] = 1;
while(!h1[p.fr].empty() && col[h1[p.fr].top()]) h1[p.fr].pop();
upd1(p.fr);
}
finalHeight[i] = qry();
}
return;
}
Compilation message
wall.cpp:2:10: fatal error: grader.h: No such file or directory
2 | #include "grader.h"
| ^~~~~~~~~~
compilation terminated.