# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
838490 |
2023-08-27T09:23:22 Z |
Andrey |
Wall (IOI14_wall) |
C++14 |
|
431 ms |
85204 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] = seg[x*2+2];
}
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++) {
| ~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47224 KB |
Output is correct |
2 |
Correct |
23 ms |
47548 KB |
Output is correct |
3 |
Incorrect |
23 ms |
47404 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
47188 KB |
Output is correct |
2 |
Correct |
199 ms |
72716 KB |
Output is correct |
3 |
Correct |
181 ms |
62152 KB |
Output is correct |
4 |
Incorrect |
431 ms |
85204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
47188 KB |
Output is correct |
2 |
Correct |
22 ms |
47572 KB |
Output is correct |
3 |
Incorrect |
20 ms |
47444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
47160 KB |
Output is correct |
2 |
Correct |
21 ms |
47572 KB |
Output is correct |
3 |
Incorrect |
20 ms |
47348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |