Submission #202353

# Submission time Handle Problem Language Result Execution time Memory
202353 2020-02-15T18:16:05 Z a_player Wall (IOI14_wall) C++14
0 / 100
3000 ms 19320 KB
#include <bits/stdc++.h>

using namespace std;
#define fh finalHeight

const int MAXN=1e5+1;
int m[MAXN][2];
int t[MAXN][2];

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    for(int i=0;i<n;i++)m[i][1]=INT_MAX;
  for(int i=0;i<k;i++){
      if(op[i]==1){
          for(int j=left[i];j<=right[i];j++){
              if(m[j][0]<=height[i]){
                  m[j][0]=height[i];
                  t[j][0]=i;
              }
          }
          
      }else{
          for(int j=left[i];j<=right[i];j++){
              if(m[j][1]>=height[i]){
                  m[j][1]=height[i];
                  t[j][1]=i;
              }
          }
      }

  }
  for(int i=0;i<n;i++){
      if(m[i][0]>=m[i][1]&&t[i][0]>t[i][1])fh[i]=m[i][0];
      if(m[i][0]>=m[i][1]&&t[i][0]<t[i][1])fh[i]=m[i][1];
      if(m[i][0]<=m[i][1])fh[i]=m[i][0];
  }
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Incorrect 8 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 392 KB Output is correct
2 Correct 187 ms 12152 KB Output is correct
3 Correct 1192 ms 7800 KB Output is correct
4 Execution timed out 3069 ms 19320 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 7 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 8 ms 504 KB Output isn't correct
3 Halted 0 ms 0 KB -