# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
838492 |
2023-08-27T09:28:16 Z |
Andrey |
벽 (IOI14_wall) |
C++14 |
|
493 ms |
122008 KB |
#include "wall.h"
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> seg(3000000,{0,INT_MAX});
vector<pair<pair<int,int>,int>> haha[1000000];
void upd(int l, int r, int x, int p, int y, int a) {
if(l == r) {
if(y == 0) {
seg[x] = {a,seg[x].second};
}
else {
seg[x] = {seg[x].first,a};
}
return;
}
int m = (l+r)/2;
if(p <= m) {
upd(l,m,x*2+1,p,y,a);
}
else {
upd(m+1,r,x*2+2,p,y,a);
}
if(seg[x*2+2].first >= seg[x*2+1].second) {
seg[x] = {min(seg[x*2+2].first,seg[x*2+2].second),min(seg[x*2+2].first,seg[x*2+2].second)};
}
else {
seg[x] = {max(seg[x*2+1].first,seg[x*2+2].first),min(seg[x*2+1].second,seg[x*2+2].second)};
}
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
for(int i = 0; i < k; i++) {
haha[left[i]].push_back({{i,op[i]-1},height[i]});
int c = 0;
if(op[i] == 2) {
c = INT_MAX;
}
haha[right[i]+1].push_back({{i,op[i]-1},c});
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < haha[i].size(); j++) {
upd(0,k-1,0,haha[i][j].first.first,haha[i][j].first.second,haha[i][j].second);
}
finalHeight[i] = min(seg[0].first,seg[0].second);
}
}
Compilation message
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int j = 0; j < haha[i].size(); j++) {
| ~~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
47188 KB |
Output is correct |
2 |
Correct |
21 ms |
47584 KB |
Output is correct |
3 |
Correct |
26 ms |
47316 KB |
Output is correct |
4 |
Correct |
23 ms |
47712 KB |
Output is correct |
5 |
Correct |
22 ms |
47708 KB |
Output is correct |
6 |
Correct |
22 ms |
47736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
47280 KB |
Output is correct |
2 |
Correct |
197 ms |
66980 KB |
Output is correct |
3 |
Correct |
151 ms |
58308 KB |
Output is correct |
4 |
Correct |
403 ms |
75480 KB |
Output is correct |
5 |
Correct |
293 ms |
83420 KB |
Output is correct |
6 |
Correct |
283 ms |
81172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
47188 KB |
Output is correct |
2 |
Correct |
20 ms |
47500 KB |
Output is correct |
3 |
Correct |
20 ms |
47316 KB |
Output is correct |
4 |
Correct |
23 ms |
47684 KB |
Output is correct |
5 |
Correct |
28 ms |
47748 KB |
Output is correct |
6 |
Correct |
24 ms |
47716 KB |
Output is correct |
7 |
Correct |
20 ms |
47316 KB |
Output is correct |
8 |
Correct |
199 ms |
72712 KB |
Output is correct |
9 |
Correct |
153 ms |
62136 KB |
Output is correct |
10 |
Correct |
428 ms |
85260 KB |
Output is correct |
11 |
Correct |
292 ms |
83420 KB |
Output is correct |
12 |
Correct |
306 ms |
81048 KB |
Output is correct |
13 |
Correct |
19 ms |
47244 KB |
Output is correct |
14 |
Correct |
216 ms |
72776 KB |
Output is correct |
15 |
Correct |
43 ms |
49732 KB |
Output is correct |
16 |
Correct |
493 ms |
85492 KB |
Output is correct |
17 |
Correct |
306 ms |
81296 KB |
Output is correct |
18 |
Correct |
317 ms |
80684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
47268 KB |
Output is correct |
2 |
Correct |
21 ms |
47468 KB |
Output is correct |
3 |
Correct |
20 ms |
47384 KB |
Output is correct |
4 |
Correct |
24 ms |
47684 KB |
Output is correct |
5 |
Correct |
25 ms |
47688 KB |
Output is correct |
6 |
Correct |
25 ms |
47692 KB |
Output is correct |
7 |
Correct |
20 ms |
47220 KB |
Output is correct |
8 |
Correct |
198 ms |
72808 KB |
Output is correct |
9 |
Correct |
152 ms |
62104 KB |
Output is correct |
10 |
Correct |
417 ms |
85204 KB |
Output is correct |
11 |
Correct |
321 ms |
83424 KB |
Output is correct |
12 |
Correct |
287 ms |
81076 KB |
Output is correct |
13 |
Correct |
19 ms |
47188 KB |
Output is correct |
14 |
Correct |
216 ms |
72804 KB |
Output is correct |
15 |
Correct |
42 ms |
49740 KB |
Output is correct |
16 |
Correct |
468 ms |
85376 KB |
Output is correct |
17 |
Correct |
305 ms |
81300 KB |
Output is correct |
18 |
Correct |
306 ms |
80584 KB |
Output is correct |
19 |
Runtime error |
183 ms |
122008 KB |
Execution killed with signal 11 |
20 |
Halted |
0 ms |
0 KB |
- |