# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1026964 |
2024-07-18T15:27:18 Z |
socpite |
벽 (IOI14_wall) |
C++17 |
|
551 ms |
142592 KB |
#include "wall.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e6+5;
const int mxval = 1e5;
struct phase{
int ty, h, id;
phase(int _ty, int _h, int _id): ty(_ty), h(_h), id(_id){};
};
vector<phase> vec[maxn];
set<int> mx[mxval + 5][2];
int st[4*mxval + 20][2];
void edit(int ty, int pos, int l = 0, int r = mxval, int id = 1){
if(l == r)st[id][ty] = (mx[l][ty].empty() ? 0 : *mx[l][ty].rbegin());
else {
int mid = (l+r)>>1;
if(pos <= mid)edit(ty, pos, l, mid, id<<1);
else edit(ty, pos, mid+1, r, id<<1|1);
st[id][ty] = max(st[id<<1][ty], st[id<<1|1][ty]);
}
}
int query(int lmax = 1, int rmax = 0, int l = 0, int r = mxval, int id = 1){
if(l == r)return l;
else {
int mid = (l+r)>>1;
if(max(st[id<<1][1], lmax) > max(st[id<<1|1][0], rmax))return query(lmax, max(st[id<<1|1][0], rmax), l, mid, id<<1);
else return query(max(st[id<<1][1], lmax), rmax, mid+1, r, id<<1|1);
}
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
for(int i = 0; i < k; i++){
vec[left[i]].push_back(phase(op[i]-1, height[i], i+2));
vec[right[i] + 1].push_back(phase(op[i]-1, height[i], i+2));
}
for(int i = 0; i < n; i++){
for(auto v: vec[i]){
if(mx[v.h][v.ty].find(v.id) != mx[v.h][v.ty].end())mx[v.h][v.ty].erase(v.id);
else mx[v.h][v.ty].insert(v.id);
edit(v.ty, v.h);
}
finalHeight[i] = query();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
59736 KB |
Output is correct |
2 |
Correct |
12 ms |
60352 KB |
Output is correct |
3 |
Correct |
10 ms |
59996 KB |
Output is correct |
4 |
Correct |
14 ms |
60244 KB |
Output is correct |
5 |
Correct |
13 ms |
58968 KB |
Output is correct |
6 |
Correct |
12 ms |
59236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
59736 KB |
Output is correct |
2 |
Correct |
260 ms |
102752 KB |
Output is correct |
3 |
Correct |
155 ms |
75076 KB |
Output is correct |
4 |
Correct |
427 ms |
98104 KB |
Output is correct |
5 |
Correct |
335 ms |
92500 KB |
Output is correct |
6 |
Correct |
308 ms |
93268 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
59740 KB |
Output is correct |
2 |
Correct |
11 ms |
60392 KB |
Output is correct |
3 |
Correct |
11 ms |
59996 KB |
Output is correct |
4 |
Correct |
15 ms |
60252 KB |
Output is correct |
5 |
Correct |
14 ms |
59000 KB |
Output is correct |
6 |
Correct |
16 ms |
58972 KB |
Output is correct |
7 |
Correct |
10 ms |
59740 KB |
Output is correct |
8 |
Correct |
252 ms |
107964 KB |
Output is correct |
9 |
Correct |
151 ms |
78480 KB |
Output is correct |
10 |
Correct |
528 ms |
106064 KB |
Output is correct |
11 |
Correct |
346 ms |
92612 KB |
Output is correct |
12 |
Correct |
330 ms |
93264 KB |
Output is correct |
13 |
Correct |
10 ms |
59740 KB |
Output is correct |
14 |
Correct |
253 ms |
107952 KB |
Output is correct |
15 |
Correct |
32 ms |
63056 KB |
Output is correct |
16 |
Correct |
411 ms |
106324 KB |
Output is correct |
17 |
Correct |
324 ms |
91196 KB |
Output is correct |
18 |
Correct |
307 ms |
91100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
59736 KB |
Output is correct |
2 |
Correct |
12 ms |
60376 KB |
Output is correct |
3 |
Correct |
11 ms |
59992 KB |
Output is correct |
4 |
Correct |
14 ms |
60252 KB |
Output is correct |
5 |
Correct |
14 ms |
58972 KB |
Output is correct |
6 |
Correct |
13 ms |
59228 KB |
Output is correct |
7 |
Correct |
9 ms |
59740 KB |
Output is correct |
8 |
Correct |
270 ms |
108024 KB |
Output is correct |
9 |
Correct |
157 ms |
78416 KB |
Output is correct |
10 |
Correct |
457 ms |
106048 KB |
Output is correct |
11 |
Correct |
355 ms |
92576 KB |
Output is correct |
12 |
Correct |
304 ms |
93268 KB |
Output is correct |
13 |
Correct |
10 ms |
59740 KB |
Output is correct |
14 |
Correct |
290 ms |
107992 KB |
Output is correct |
15 |
Correct |
35 ms |
63000 KB |
Output is correct |
16 |
Correct |
442 ms |
106308 KB |
Output is correct |
17 |
Correct |
335 ms |
91220 KB |
Output is correct |
18 |
Correct |
346 ms |
91224 KB |
Output is correct |
19 |
Correct |
500 ms |
142592 KB |
Output is correct |
20 |
Correct |
551 ms |
140340 KB |
Output is correct |
21 |
Correct |
537 ms |
140636 KB |
Output is correct |
22 |
Correct |
483 ms |
140020 KB |
Output is correct |
23 |
Correct |
469 ms |
140116 KB |
Output is correct |
24 |
Correct |
521 ms |
138116 KB |
Output is correct |
25 |
Correct |
448 ms |
138180 KB |
Output is correct |
26 |
Correct |
447 ms |
140628 KB |
Output is correct |
27 |
Correct |
465 ms |
140468 KB |
Output is correct |
28 |
Correct |
474 ms |
140016 KB |
Output is correct |
29 |
Correct |
483 ms |
138064 KB |
Output is correct |
30 |
Correct |
523 ms |
138064 KB |
Output is correct |