Submission #1043501

# Submission time Handle Problem Language Result Execution time Memory
1043501 2024-08-04T10:14:55 Z Malix Wall (IOI14_wall) C++14
8 / 100
504 ms 9040 KB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
 
ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;

void buildWall(int n, int k, int t[], int l[], int r[], int h[], int finalHeight[]){
  vi ans(n,0);
  int m=sqrt(n);
  vi b(m+2,0),c(m+2,inf);
  REP(i,0,k){
    int x=l[i]/m;
    int y=r[i]/m;
    REP(j,x+1,y){
      if(t[i]==1){
        b[j]=max(b[j],h[i]);
        c[j]=max(c[j],h[i]);
      }
      else{
        c[j]=min(c[j],h[i]);
        b[j]=min(b[j],h[i]);
      }
    }
    REP(j,x*m,min(n,x*m+m)){
      if(c[x]!=0)ans[j]=min(ans[j],c[x]);
      if(b[x]!=0)ans[j]=max(ans[j],b[x]);
    }
    b[x]=0;c[x]=inf;
    REP(j,y*m,min(n,y*m+m)){
      if(c[y]!=0)ans[j]=min(ans[j],c[y]);
      if(b[y]!=0)ans[j]=max(ans[j],b[y]);
    }
    b[y]=0;c[y]=inf;
    REP(j,l[i],min(min(n,x*m+m),r[i]+1)){
      if(t[i]==1)ans[j]=max(ans[j],h[i]);
      else ans[j]=min(ans[j],h[i]);
    }
    REP(j,max(l[i],y*m),r[i]+1){
      if(t[i]==1)ans[j]=max(ans[j],h[i]);
      else ans[j]=min(ans[j],h[i]);
    }
  }
  REP(j,0,n){
    if(c[j/m]!=0)ans[j]=min(ans[j],c[j/m]);
    if(b[j/m]!=0)ans[j]=max(ans[j],b[j/m]);
  }
  REP(i,0,n)finalHeight[i]=ans[i];
  return;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 79 ms 8140 KB Output is correct
3 Correct 122 ms 3804 KB Output is correct
4 Incorrect 504 ms 9040 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 67 ms 8068 KB Output is correct
9 Correct 120 ms 3668 KB Output is correct
10 Incorrect 491 ms 9004 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 87 ms 8052 KB Output is correct
9 Correct 128 ms 3668 KB Output is correct
10 Incorrect 499 ms 8948 KB Output isn't correct
11 Halted 0 ms 0 KB -