# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
39646 |
2018-01-17T02:21:26 Z |
funcsr |
벽 (IOI14_wall) |
C++14 |
|
846 ms |
143092 KB |
#include "wall.h"
#include <vector>
#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
#include <cassert>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define MAX_N (1<<19)
#define INF 1145141919
#define pb push_back
struct Node {
int a, b;
Node(int a, int b) : a(a), b(b) {}
Node() : a(INF), b(0) {}
int f(int x) { return min(a, max(b, x)); }
};
inline Node op(const Node &l, const Node &r) {
return Node(min(r.a, max(l.a, r.b)), max(l.b, r.b));
}
Node seg[MAX_N*2-1];
void update(int k, const Node &v) {
k += MAX_N-1;
seg[k] = v;
while (k > 0) {
k = (k-1)/2;
seg[k] = op(seg[k*2+1], seg[k*2+2]);
}
}
vector<int> GL[2000000], GR[2000000];
void buildWall(int N, int K, int op[], int left[], int right[], int height[], int finalHeight[]) {
rep(i, K) GL[left[i]].pb(i);
rep(i, K) GR[right[i]].pb(i);
rep(i, N) {
for (int x : GL[i]) {
if (op[x] == 1) update(x, Node(INF, height[x]));
else update(x, Node(height[x], 0));
}
finalHeight[i] = seg[0].f(0);
for (int x : GR[i]) update(x, Node());
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
103956 KB |
Output is correct |
2 |
Correct |
33 ms |
104092 KB |
Output is correct |
3 |
Correct |
36 ms |
104088 KB |
Output is correct |
4 |
Correct |
39 ms |
104356 KB |
Output is correct |
5 |
Correct |
43 ms |
104224 KB |
Output is correct |
6 |
Correct |
39 ms |
104224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
103956 KB |
Output is correct |
2 |
Correct |
326 ms |
118008 KB |
Output is correct |
3 |
Correct |
259 ms |
110388 KB |
Output is correct |
4 |
Correct |
756 ms |
121280 KB |
Output is correct |
5 |
Correct |
353 ms |
119324 KB |
Output is correct |
6 |
Correct |
373 ms |
119060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
103956 KB |
Output is correct |
2 |
Correct |
29 ms |
104092 KB |
Output is correct |
3 |
Correct |
33 ms |
104088 KB |
Output is correct |
4 |
Correct |
39 ms |
104356 KB |
Output is correct |
5 |
Correct |
39 ms |
104224 KB |
Output is correct |
6 |
Correct |
33 ms |
104224 KB |
Output is correct |
7 |
Correct |
39 ms |
103956 KB |
Output is correct |
8 |
Correct |
349 ms |
118008 KB |
Output is correct |
9 |
Correct |
293 ms |
110388 KB |
Output is correct |
10 |
Correct |
769 ms |
121280 KB |
Output is correct |
11 |
Correct |
386 ms |
119324 KB |
Output is correct |
12 |
Correct |
356 ms |
119060 KB |
Output is correct |
13 |
Correct |
29 ms |
103956 KB |
Output is correct |
14 |
Correct |
329 ms |
118008 KB |
Output is correct |
15 |
Correct |
59 ms |
105376 KB |
Output is correct |
16 |
Correct |
823 ms |
121148 KB |
Output is correct |
17 |
Correct |
459 ms |
119052 KB |
Output is correct |
18 |
Correct |
406 ms |
118788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
103956 KB |
Output is correct |
2 |
Correct |
33 ms |
104092 KB |
Output is correct |
3 |
Correct |
29 ms |
104088 KB |
Output is correct |
4 |
Correct |
19 ms |
104356 KB |
Output is correct |
5 |
Correct |
39 ms |
104224 KB |
Output is correct |
6 |
Correct |
33 ms |
104224 KB |
Output is correct |
7 |
Correct |
26 ms |
103956 KB |
Output is correct |
8 |
Correct |
273 ms |
118008 KB |
Output is correct |
9 |
Correct |
269 ms |
110388 KB |
Output is correct |
10 |
Correct |
846 ms |
121280 KB |
Output is correct |
11 |
Correct |
336 ms |
119324 KB |
Output is correct |
12 |
Correct |
329 ms |
119060 KB |
Output is correct |
13 |
Correct |
36 ms |
103956 KB |
Output is correct |
14 |
Correct |
326 ms |
118008 KB |
Output is correct |
15 |
Correct |
59 ms |
105376 KB |
Output is correct |
16 |
Correct |
799 ms |
121148 KB |
Output is correct |
17 |
Correct |
423 ms |
119052 KB |
Output is correct |
18 |
Correct |
426 ms |
118788 KB |
Output is correct |
19 |
Correct |
743 ms |
143092 KB |
Output is correct |
20 |
Correct |
673 ms |
143092 KB |
Output is correct |
21 |
Correct |
733 ms |
143092 KB |
Output is correct |
22 |
Correct |
666 ms |
143092 KB |
Output is correct |
23 |
Correct |
696 ms |
143092 KB |
Output is correct |
24 |
Correct |
609 ms |
143092 KB |
Output is correct |
25 |
Correct |
653 ms |
143092 KB |
Output is correct |
26 |
Correct |
776 ms |
143092 KB |
Output is correct |
27 |
Correct |
666 ms |
143092 KB |
Output is correct |
28 |
Correct |
756 ms |
143092 KB |
Output is correct |
29 |
Correct |
699 ms |
143092 KB |
Output is correct |
30 |
Correct |
769 ms |
143092 KB |
Output is correct |