# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1088362 |
2024-09-14T09:57:29 Z |
Sunbae |
Wall (IOI14_wall) |
C++17 |
|
78 ms |
188244 KB |
#include <bits/stdc++.h>
#define z exit(0)
using namespace std;
const int N = 2e6 + 1;
vector<tuple<int,int,int>> s[N<<2];
int L, R, v, ti, o, idx[N], A[N];
tuple<int,int,int> T[N];
void ini(int I, int lo, int hi){
if(lo == hi){ idx[lo] = I; return;}
int m = lo + ((hi-lo)>>1);
ini(I<<1, lo, m); ini(I<<1|1, m+1, hi);
}
void upd(int I, int lo, int hi){
if(lo > R || hi < L) return;
if(L <= lo && hi <= R){ s[I].emplace_back(ti, o, v); return;}
int m = lo + ((hi-lo)>>1);
upd(I<<1, lo, m); upd(I<<1|1, m+1, hi);
}
void buildWall(int n, int k, int op[], int l[], int r[], int H[], int fH[]){
for(int i = 0; i<(n<<2); ++i) s[i].clear();
ini(1, 0, n-1);
for(ti = 0; ti<k; ++ti){
L = l[ti]; R = r[ti]; o = op[ti]-1; v = H[ti];
upd(1, 0, n-1);
}
fH = A;
for(int i = 0; i<n; ++i){
int m = 0;
for(int I = idx[i]; I; I>>=1) for(auto it : s[I]) T[m++] = it;
sort(T, T+m);
fH[i] = 0;
for(int j = 0; j<m; ++j){
auto it = T[j];
o = get<1>(it); v = get<2>(it);
fH[i] = !o ? max(fH[i], v) : min(fH[i], v);
}
}
}
/*
signed main(){
int n, k; scanf("%d %d", &n, &k);
int op[k], l[k], r[k], H[k];
for(int i = 0; i<k; ++i){
scanf("%d %d %d %d", op+i, l+i, r+i, H+i);
}
int* fH;
buildWall(n, k, op, l, r, H, fH);
for(int i = 0; i<n; ++i) printf("%d ", A[i]);
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
188244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
188080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
188244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
188240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |