# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1083220 |
2024-09-02T18:30:18 Z |
modwwe |
Wall (IOI14_wall) |
C++17 |
|
1 ms |
2396 KB |
#pragma GCC optimize("Ofast,unroll-loops")
#include "wall.h"
#include<bits/stdc++.h>
//#define int long long
//#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".ans","w",stdout)
#define pb push_back
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
#define getchar_unlocked getchar
inline int scan()
{
char c = getchar_unlocked();
int x = 0;
while(c<'0'||c>'9')
{
c=getchar_unlocked();
}
while(c>='0'&&c<='9')
{
x=(x<<1)+(x<<3)+c-'0';
c=getchar_unlocked();
}
return x;
}
void phongbeo();
const int inf=1e9;
const int mod2=998244353;
const int mod1=998244353;
struct icd
{
long double a;
int b;
};
struct ib
{
int a;
int b;
};
struct ic
{
int a,b,c;
};
struct id
{
int a,b,c,d;
};
struct ie
{
int a,b,c,d,e;
};
int n,m,s1,s2,s4,s3,sf,k,s5,s6,mx,s7,s8,s9,mx2,res,dem2=0,dem=0,s33,dem3,dem4,l,r,mid,l2,r2;
int i,s10,s12;
int kk;
int el=29;
struct IT
{
ib t[8000001];
bool t2[8000001];
void ff(int x)
{
if(!t2[x]) return;
for(int i=x*2; i<=x*2+1; i++)
if(t2[i]==0)
{
t[i]=t[x];
t2[i]=t2[x];
}
else
{
t[i].b=min(t[i].b,t[x].b);
t[i].a=max(t[i].a,t[x].a);
if(t[x].b<t[i].a)
t[i].a=t[i].b;
if(t[x].a>t[i].b)
t[i].b=t[i].a;
}
t[x].a=0;
t[x].b=1e9;
t2[x]=0;
}
void upd(int node,int l,int r,int l1,int r1,int x,bool d)
{
if(l>r1||r<l1) return;
if(l>=l1&&r<=r1)
{
if(!d)
{
t[node].b=min(t[node].b,x);
t[node].a=min(t[node].a,x);
}
else
{
t[node].a=max(t[node].a,x);
t[node].b=max(t[node].b,x);
}
t2[node]=1;
return;
}
ff(node);
int mid=l+r>>1;
upd(node<<1,l,mid,l1,r1,x,d);
upd(node<<1|1,mid+1,r,l1,r1,x,d);
}
void setup(int node,int l,int r,int c[])
{
if(l==r)
{
c[l]=t[node].a;
return;
}
int mid=l+r>>1;
ff(node);
setup(node<<1,l,mid,c);
setup(node<<1|1,mid+1,r,c);
}
} st;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
for(int i=1; i<=n*4; i++)
st.t[i].b=1e9;
for(int i=0; i<k; i++)
{
if(op[i]==1)
{
l=left[i-1];
r=right[i-1];
s2=height[i-1];
st.upd(1,1,n,l+1,r+1,s2,1);
}
else
{
l=left[i-1];
r=right[i-1];
s2=height[i-1];
st.upd(1,1,n,l+1,r+1,s2,0);
}
}
st.setup(1,1,n,height);
}
/**
5
2
1 3 4 3
2 3 5 2
*/
Compilation message
wall.cpp: In member function 'void IT::upd(int, int, int, int, int, int, bool)':
wall.cpp:114:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
114 | int mid=l+r>>1;
| ~^~
wall.cpp: In member function 'void IT::setup(int, int, int, int*)':
wall.cpp:125:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
125 | int mid=l+r>>1;
| ~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |