# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
722626 |
2023-04-12T12:57:44 Z |
penguin133 |
Wall (IOI14_wall) |
C++17 |
|
221 ms |
10284 KB |
#include <bits/stdc++.h>
#include "wall.h"
using namespace std;
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct node{
int s, e, m, val, mx, mn;
node *l, *r;
node (int _s, int _e){
s = _s, e = _e, m = (s + e) >> 1;
if(s != e)l = new node(s, m), r = new node(m+1, e);
val = mx = 0 ;
mn = 2e9;
}
void prop(){
if(mx)val = max(val, mx);
if(mn != 2e9)val = min(val, mn);
if(s != e){
if(mx)l->mx = mx, r->mx = mx;
if(mn != 2e9)l->mn = mn, r->mn = mn;
}
mx = 0; mn = 2e9;
}
void upd(int a, int b, int c, bool d){
//cerr << "UPD " << a << ' ' << b << ' ' << c << ' ' << d << '\n';
prop();
if(a == s && b == e){
if(!d)mx = c;
else mn = c;
return;
}
if(b <= m)l->upd(a, b, c, d);
else if(a > m)r->upd(a, b, c, d);
else l->upd(a, m, c, d), r->upd(m+1, b, c, d);
l->prop(), r->prop();
}
int qry(int x){
prop();
if(s == e)return val;
if(x <= m)return l->qry(x);
else return r->qry(x);
}
}*root;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
root = new node(0, n - 1);
//cerr << "ok\n";
for(int i=0;i<k;i++){
if(op[i] == 1)root->upd(left[i], right[i], height[i], 0);
else root->upd(left[i], right[i], height[i], 1);
//cerr << "what\n";
}
//cerr << "ok\n";
for(int i=0;i<n;i++)finalHeight[i] = root->qry(i);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
130 ms |
10284 KB |
Output is correct |
3 |
Incorrect |
221 ms |
7368 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Incorrect |
2 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |