제출 #41275

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
412752018-02-15 10:25:38SecretAgent007Wall (IOI14_wall)C++14
100 / 100
715 ms262144 KiB
#include<algorithm>
#include<cstdio>
#include "wall.h"
using namespace std;
const int maxn=2000000+5;
const int INF=(1<<30);
int Max[maxn*6],Min[maxn*6];
inline void add(int id,int val)
{
if(Max[id]==-1) Min[id]=max(Min[id],val);
else if(val>=Max[id]) Min[id]=val,Max[id]=-1;
else if(val>=Min[id]) Min[id]=val;
}
inline void remove(int id,int val)
{
if(Max[id]==-1) Min[id]=min(Min[id],val);
else if(val<=Min[id]) Min[id]=val,Max[id]=-1;
else if(val<=Max[id]) Max[id]=val;
}
inline void push(int id)
{
if(Max[id]==-1)
{
Max[id*2]=Max[id*2+1]=-1;
Min[id*2]=Min[id*2+1]=Min[id];
Max[id]=INF,Min[id]=0;
return;
}
if(Min[id]!=0) { add(id*2,Min[id]); add(id*2+1,Min[id]);}
if(Max[id]!=INF) { remove(id*2,Max[id]); remove(id*2+1,Max[id]); }
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...